From d7b435820ccaad8d98a0088573f78d5f1e83fd77 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Tue, 5 Sep 2023 14:39:24 +0100 Subject: [PATCH] Add actionlint - Add GitHub Actions workflow to lint workflows with actionlint. - Configure Visual Studio Code extensions. --- .github/actionlint-matcher.json | 17 ++++++++++++++ .github/workflows/lint.yml | 39 +++++++++++++++++++++++++++++++++ .vscode/extensions.json | 7 ++++++ 3 files changed, 63 insertions(+) create mode 100644 .github/actionlint-matcher.json create mode 100644 .github/workflows/lint.yml create mode 100644 .vscode/extensions.json diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 00000000..b456c26e --- /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/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..25317a97 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +name: lint + +on: + push: + branches: [ main ] + paths-ignore: + - '**/*.gitattributes' + - '**/*.gitignore' + - '**/*.md' + pull_request: + branches: + - main + - dotnet-vnext + workflow_dispatch: + +permissions: + contents: read + +env: + FORCE_COLOR: 3 + TERM: xterm + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + + - name: Lint workflows + shell: bash + env: + ACTIONLINT_VERSION: '7b75d16d41920ec126e6f3269db0c6f3ab613c38' # v1.6.25 + run: | + echo "::add-matcher::.github/actionlint-matcher.json" + bash <(curl --silent --show-error "https://raw.githubusercontent.com/rhysd/actionlint/${ACTIONLINT_VERSION}/scripts/download-actionlint.bash") + ./actionlint -color diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..3fad574e --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "editorconfig.editorconfig", + "ms-dotnettools.csharp", + "ms-vscode.PowerShell" + ] +}