From 177b3d07aa052a5713949805c100c13079cdbe84 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Fri, 25 Apr 2025 15:14:47 +0200 Subject: [PATCH 1/7] Add jobs for Typos, Prettier and ESLint Related to: https://github.com/ikelax/userscripts/issues/3 --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..788b90a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +permissions: + contents: read + +on: + pull_request: + branches: [main] + +env: + CLICOLOR: 1 + +jobs: + spelling: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Spell Check Repo + uses: crate-ci/typos@v1.31.1 + prettier: + name: Prettier + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install dependencies + run: npm clean-install + - name: Check formatting with Prettier + run: npm run prettier:check + - name: Code Linting with ESLint + run: npm run lint From 442c3cd9fcdf1482f68e068682b86d576bdee534 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Fri, 25 Apr 2025 15:21:48 +0200 Subject: [PATCH 2/7] Use better name for linting and formatting job --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 788b90a..6a8a56d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,8 @@ jobs: uses: actions/checkout@v4 - name: Spell Check Repo uses: crate-ci/typos@v1.31.1 - prettier: - name: Prettier + js: + name: Check linting and formatting runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -31,5 +31,5 @@ jobs: run: npm clean-install - name: Check formatting with Prettier run: npm run prettier:check - - name: Code Linting with ESLint + - name: Code linting with ESLint run: npm run lint From 4978ef88b23eb84fb29387cfddf24e16e1501b31 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Fri, 25 Apr 2025 15:24:23 +0200 Subject: [PATCH 3/7] Add actionlint I also enabled the problem matchers for it. See also: https://github.com/rhysd/actionlint/blob/v1.7.7/docs/usage.md#use-actionlint-on-github-actions See also: https://github.com/rhysd/actionlint/blob/v1.7.7/docs/usage.md#problem-matchers --- .github/actionlint-matcher.json | 17 +++++++++++++++++ .github/workflows/actionlint.yml | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .github/actionlint-matcher.json create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 0000000..4613e16 --- /dev/null +++ b/.github/actionlint-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "actionlint", + "pattern": [ + { + "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + "code": 5 + } + ] + } + ] +} diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000..b533136 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,17 @@ +name: Lint GitHub Actions workflows +on: [push, pull_request] + +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download actionlint + id: get_actionlint + run: | + echo "::add-matcher::.github/actionlint-matcher.json" + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + shell: bash + - name: Check workflow files + run: ${{ steps.get_actionlint.outputs.executable }} -color + shell: bash From 85b6eef80fe62a35a6ad86d58c8105491fce022c Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Sat, 26 Apr 2025 00:09:12 +0200 Subject: [PATCH 4/7] Add markdownlint --- .github/workflows/actionlint.yml | 4 ++++ .github/workflows/markdownlint.yml | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 .github/workflows/markdownlint.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index b533136..ac04f09 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -1,4 +1,8 @@ name: Lint GitHub Actions workflows + +permissions: + contents: read + on: [push, pull_request] jobs: diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml new file mode 100644 index 0000000..b20c863 --- /dev/null +++ b/.github/workflows/markdownlint.yml @@ -0,0 +1,14 @@ +name: CI + +permissions: + contents: read + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: xt0rted/markdownlint-problem-matcher@v3 + - run: markdownlint ./**/*.md --ignore node_modules From ef5f9cbde5150eb3e5c456343661f12815626fa7 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Sat, 26 Apr 2025 00:11:12 +0200 Subject: [PATCH 5/7] Use markdownlint-cli2 The GitHub Action for markdownlint-cli does not work because it is not installed in ubuntu-latest. --- .github/workflows/markdownlint.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index b20c863..5d75ae5 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -10,5 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: xt0rted/markdownlint-problem-matcher@v3 - - run: markdownlint ./**/*.md --ignore node_modules + - uses: DavidAnson/markdownlint-cli2-action@v19 + with: + globs: "**/*.md" From 8a6139814f5187e0f07fb9207f8046c8bf4163fc Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Sat, 26 Apr 2025 00:13:46 +0200 Subject: [PATCH 6/7] Lint only README.md --- .github/workflows/markdownlint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 5d75ae5..048ecff 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -12,4 +12,5 @@ jobs: - uses: actions/checkout@v4 - uses: DavidAnson/markdownlint-cli2-action@v19 with: - globs: "**/*.md" + globs: | + README.md From 4f9459218e61dde470dd94eb5dd675235a8f6f2d Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Sat, 26 Apr 2025 00:23:25 +0200 Subject: [PATCH 7/7] Add labeler --- .github/labels.yml | 19 +++++++++++++++++++ .github/workflows/labels.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .github/labels.yml create mode 100644 .github/workflows/labels.yml diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..af433b8 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,19 @@ +- name: "bug" + color: "#d73a4a" + description: "Something isn't working" +- name: "documentation" + color: "#e99695" + description: "Improvements or additions to documentation" +- name: "duplicate" + color: "#cfd3d7" + description: "This issue or pull request already exists" +- name: "enhancement" + color: "#a22eef" + description: "New feature or request" +- name: "renovate" + color: "#272895" +- name: "question" + color: "#d876e3" +- name: "wontfix" + color: "#ffffff" + description: "This will not be worked on" diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..46efd90 --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,30 @@ +name: GitHub + +on: + push: + branches: + - "main" + paths: + - ".github/labels.yml" + - ".github/workflows/labels.yml" + pull_request: + paths: + - ".github/labels.yml" + - ".github/workflows/labels.yml" + +jobs: + labeler: + name: Labeler + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run Labeler + uses: crazy-max/ghaction-github-labeler@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + yaml-file: .github/labels.yml + dry-run: ${{ github.event_name == 'pull_request' }}