@@ -70,14 +70,30 @@ jobs:
7070 run : yarn start format.listDifferent
7171 - name : Type-check TypeScript
7272 run : yarn run type-check
73- - name : Lint GitHub Actions
74- # We only download and run Actionlint if there is any difference in GitHub Action workflows
75- # https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions
73+ # We only download and run Actionlint if there is any difference in GitHub Action workflows
74+ # https://github.com/rhysd/actionlint/blob/main/docs/usage.md#on-github-actions
75+ - name : Check for GitHub Actions changes
76+ id : check-workflows
7677 run : |
7778 git fetch origin ${{ github.event.pull_request.base.sha }}
7879 if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q '^.github/workflows'; then
79- echo "::add-matcher::.github/actionlint-matcher.json "
80- bash < (curl https://raw.githubusercontent .com/rhysd/actionlint/main/scripts/download-actionlint.bash )
81- SHELLCHECK_OPTS="-S warning" ./actionlint -color
80+ echo "changed=true" >> "$GITHUB_OUTPUT "
81+ actionlint_version=$ (curl -s https://api.github .com/repos/ rhysd/actionlint/releases/latest | jq -r .tag_name )
82+ echo "actionlint_version=\"$actionlint_version\"" >> "$GITHUB_OUTPUT"
8283 fi
84+ - name : Setup Actionlint
85+ if : steps.check-workflows.outputs.changed == 'true'
86+ uses : actions/cache@v4
87+ id : cache-actionlint
88+ with :
89+ path : ./actionlint
90+ key : ${{ runner.os }}-actionlint-${{ steps.check-workflows.outputs.actionlint_version }}
91+ - name : Download Actionlint
92+ if : steps.check-workflows.outputs.changed == 'true' && steps.cache-actionlint.outputs.cache-hit != 'true'
93+ run : bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
94+ - name : Lint GitHub Actions
95+ if : steps.check-workflows.outputs.changed == 'true'
96+ run : |
97+ echo "::add-matcher::.github/actionlint-matcher.json"
98+ SHELLCHECK_OPTS="-S warning" ./actionlint -color
8399 shell : bash
0 commit comments