From 445c582a997fa24381ddd7dca1c347870852bcf8 Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 4 Sep 2023 08:48:19 +0100 Subject: [PATCH] Add actionlint Add a workflow to lint GitHub Actions workflows. --- .github/actionlint-matcher.json | 17 ++++++++++++++ .github/workflows/actions-lint.yml | 36 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/actionlint-matcher.json create mode 100644 .github/workflows/actions-lint.yml diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 00000000000..4613e1617bf --- /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/actions-lint.yml b/.github/workflows/actions-lint.yml new file mode 100644 index 00000000000..d3186010356 --- /dev/null +++ b/.github/workflows/actions-lint.yml @@ -0,0 +1,36 @@ +name: actions-lint + +on: + push: + branches: [ main ] + paths-ignore: + - '**/*.gitattributes' + - '**/*.gitignore' + - '**/*.md' + pull_request: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + +env: + FORCE_COLOR: 3 + TERM: xterm + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Add actionlint problem matcher + run: echo "::add-matcher::.github/actionlint-matcher.json" + + - name: Lint workflows + uses: docker://rhysd/actionlint@sha256:86ebdb1c0df5a8be92b9d53e2e0c636978a2b3c6e52c86c65a77e2c78a6bd594 # v1.6.25 + with: + args: -color