Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update actionlint and factor out its config into a reusable action. #1360

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading