Skip to content

Commit 4d713d9

Browse files
committed
refactor: cache actionlint binary
1 parent da30115 commit 4d713d9

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,18 +495,33 @@ jobs:
495495
needs: [release-versions]
496496
if: needs.release-versions.outputs.github-actions-changed
497497
runs-on: ubuntu-24.04-arm
498+
env:
499+
ACTIONLINT_VERSION: 1.7.12
498500
steps:
499501
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
500-
- name: Check workflow files
502+
503+
- name: Cache actionlint binary
504+
id: cache
505+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
506+
with:
507+
path: ~/actionlint
508+
key: actionlint-${{ env.ACTIONLINT_VERSION }}-${{ runner.os }}-${{ runner.arch }}
509+
510+
- name: Get actionlint
501511
shell: bash
512+
if: steps.cache.outputs.cache-hit != 'true'
502513
run: |
503-
echo "::add-matcher::.github/actionlint-matcher.json"
504-
ACTIONLINT_VERSION=1.7.8
505-
curl -fsSLO "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
506-
curl -fsSLO "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_checksums.txt"
507-
grep " actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz$" "actionlint_${ACTIONLINT_VERSION}_checksums.txt" | sha256sum -c -
508-
tar -xzf "actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" actionlint
509-
./actionlint -color
514+
TAR_NAME="actionlint_${ACTIONLINT_VERSION}_$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]')_$(echo $RUNNER_ARCH | tr '[:upper:]' '[:lower:]').tar.gz"
515+
curl -fsSLO "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/${TAR_NAME}"
516+
curl -fsSLo checksums.txt "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_checksums.txt"
517+
grep " ${TAR_NAME}$" "checksums.txt" | sha256sum -c -
518+
tar -xzf "${TAR_NAME}" ~/actionlint
519+
520+
- name: Run actionlint
521+
shell: bash
522+
run: |
523+
command ~/actionlint -color
524+
510525
511526
checks:
512527
needs: [release-versions, packages-build]

0 commit comments

Comments
 (0)