Skip to content

Commit

Permalink
Merge pull request #1360 from alphagov/sengi/actionlint
Browse files Browse the repository at this point in the history
Update actionlint and factor out its config into a reusable action.
  • Loading branch information
sengi authored Jul 3, 2024
2 parents 10a3740 + e334fe0 commit f86867b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
27 changes: 27 additions & 0 deletions .github/actions/actionlint/action.yml
Original file line number Diff line number Diff line change
@@ -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"
24 changes: 4 additions & 20 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f86867b

Please sign in to comment.