From 60191bd7c2bf2aec245522c987805724d544dbe4 Mon Sep 17 00:00:00 2001 From: JayShortway <29483617+JayShortway@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:38:01 +0200 Subject: [PATCH] Adds actionlint to lint GitHub Actions workflows (#227) --- .github/actionlint-matcher.json | 17 +++++++++++++++++ .github/workflows/actionlint.yml | 19 +++++++++++++++++++ 2 files changed, 36 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 00000000..4613e161 --- /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 00000000..505782b9 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,19 @@ +name: Lint GitHub Actions workflows +on: + push: + branches: [main] + paths: ['.github/workflows/**'] + pull_request: + paths: ['.github/workflows/**'] + +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Enable the actionlint matcher + run: echo "::add-matcher::.github/actionlint-matcher.json" + - name: Lint GitHub Actions workflows + uses: docker://rhysd/actionlint:latest + with: + args: -color