diff --git a/.github/actions/actionlint/action.yml b/.github/actions/actionlint/action.yml new file mode 100644 index 000000000..821e7b26d --- /dev/null +++ b/.github/actions/actionlint/action.yml @@ -0,0 +1,27 @@ +# This reusable action exists only to reduce toil by representing GOV.UK's +# global config for rhysd/actionlint in a single place so we don't have to +# change it in N repos every time we update. +name: Run actionlint +description: Lint GitHub Actions YAML files with rhysd/actionlint. +runs: + using: composite + steps: + - id: install + shell: bash + env: + ACTIONLINT_SHA: 4f6274a8e0f4f4d2057aa9ae07660f61aa29c5f3 # v1.7.1 + run: bash <(curl "https://raw.githubusercontent.com/rhysd/actionlint/$ACTIONLINT_SHA/scripts/download-actionlint.bash") + - name: Run actionlint + shell: bash + env: + ACTIONLINT: '${{ steps.install.outputs.executable }}' + run: | + echo "::add-matcher::.github/actionlint-matcher.json" + # TODO: move non-global ignores inline or to in-tree actionlint.yml once + # https://www.github.com/rhysd/actionlint/issues/237 and/or + # https://www.github.com/rhysd/actionlint/issues/217 is fixed. + # TODO: remove -ignore "property .runner. is not defined" once + # https://www.github.com/rhysd/actionlint/issues/77 is fixed. + "$ACTIONLINT" -color \ + -ignore "property .runner. is not defined" \ + -ignore "property .repository_visibility. is not defined" diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 8343da79f..a6ab5dba3 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -6,23 +6,7 @@ jobs: actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - show-progress: false - - id: install - env: - VERSION: '1.7.0' - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/b6b7a2901eb4fa4bae2e6d8f9b6edd1a37b3cca7/scripts/download-actionlint.bash) "$VERSION" . - - name: Run actionlint - env: - ACTIONLINT: '${{ steps.install.outputs.executable }}' - run: | - echo "::add-matcher::.github/actionlint-matcher.json" - # TODO: move -ignores inline or to actionlint.yml once - # https://www.github.com/rhysd/actionlint/issues/237 and/or - # https://www.github.com/rhysd/actionlint/issues/217 is fixed. - # TODO: remove -ignore "property .runner. is not defined" once - # https://www.github.com/rhysd/actionlint/issues/77 is fixed. - "$ACTIONLINT" -color \ - -ignore "property .runner. is not defined" \ - -ignore "property .repository_visibility. is not defined" + - uses: actions/checkout@v4 + with: + show-progress: false + - uses: alphagov/govuk-infrastructure/.github/actions/actionlint@main