From 7b85950e7a0b640a36a63c3e0630e54f049302d2 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 12 Apr 2023 12:04:44 +0800 Subject: [PATCH] workflows: add actionlint workflow Co-authored-by: Bo Anderson --- .github/actionlint-matcher.json | 17 ++++++++++++ .github/actionlint.yaml | 8 ++++++ .github/workflows/actionlint.yml | 47 ++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 .github/actionlint-matcher.json create mode 100644 .github/actionlint.yaml create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 0000000000000..4613e1617bfe2 --- /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/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 0000000000000..4ae8fc863957c --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,8 @@ +self-hosted-runner: + # Labels of self-hosted runner in array of strings. + labels: + - 11-arm64 +# Configuration variables in array of strings defined in your repository or +# organization. `null` means disabling configuration variables check. +# Empty array means no configuration variable is allowed. +config-variables: [] diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000000000..d518b595e57ad --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,47 @@ +name: actionlint + +on: + push: + branches: + - master + paths: + - '.github/workflows/*.ya?ml' + pull_request: + paths: + - '.github/workflows/*.ya?ml' + merge_group: + +env: + HOMEBREW_DEVELOPER: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_ENV_HINTS: 1 + +concurrency: + group: "actionlint-${{ github.ref }}" + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + workflow_syntax: + if: github.repository_owner == 'Homebrew' + runs-on: ubuntu-22.04 + steps: + - name: Set up Homebrew + id: setup-homebrew + uses: Homebrew/actions/setup-homebrew@master + with: + test-bot: false + + - name: Set up actionlint + env: + HOMEBREW_REPOSITORY: ${{ steps.setup-homebrew.outputs.repository-path }} + run: | + brew install actionlint shellcheck + + # Annotations work only relative to GITHUB_WORKSPACE + (shopt -s dotglob; rm -rf "${GITHUB_WORKSPACE:?}"/*; mv "${HOMEBREW_REPOSITORY:?}"/* "$GITHUB_WORKSPACE") + rmdir "$HOMEBREW_REPOSITORY" + ln -vs "$GITHUB_WORKSPACE" "$HOMEBREW_REPOSITORY" + + echo "::add-matcher::.github/actionlint-matcher.json" + + - run: actionlint