Skip to content

Commit

Permalink
ci(github): refactor ActionLint job to use the official installer
Browse files Browse the repository at this point in the history
1. Previously we just winged it with a bash script downloading another
bash script to unzip the actionlint binaries.
2. From now on we'll use the GitHub action from the marketplace which
has a lot of configuration options exposed in a convenient way such as
what type of warnings to ignore, what version of actionlint to install,
etc.

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Apr 4, 2024
1 parent e05392b commit 7951784
Showing 1 changed file with 61 additions and 9 deletions.
70 changes: 61 additions & 9 deletions .github/workflows/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,66 @@ on:
workflow_call:

jobs:
actionlint:
Lint_GitHub_Actions:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.6.25/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
- name: git_clone
uses: actions/[email protected]

# We need to wipe the root package.json file because the installation of actionlint fails otherwise like this:
#
# npm ERR! code ERESOLVE
# npm ERR! ERESOLVE could not resolve
# npm ERR!
# npm ERR! While resolving: [email protected]
# npm ERR! Found: [email protected]
# npm ERR! node_modules/typescript
# npm ERR! dev typescript@"5.3.3" from the root project
# npm ERR! peerOptional typescript@">=3.7.2" from [email protected]
# npm ERR! node_modules/tap
# npm ERR! dev tap@"16.3.8" from the root project
# npm ERR! 25 more (ts-jest, @hyperledger/cactus-plugin-satp-hermes, ...)
# npm ERR!
# npm ERR! Could not resolve dependency:
# npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected]
# npm ERR! node_modules/react-scripts
# npm ERR! react-scripts@"5.0.1" from @hyperledger/[email protected]
# npm ERR! examples/cactus-example-cbdc-bridging-frontend
# npm ERR! @hyperledger/[email protected]
# npm ERR! node_modules/@hyperledger/cacti-example-cbdc-bridging-frontend
# npm ERR! workspace examples/cactus-example-cbdc-bridging-frontend from the root project
# npm ERR!
# npm ERR! Conflicting peer dependency: [email protected]
# npm ERR! node_modules/typescript
# npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected]
# npm ERR! node_modules/react-scripts
# npm ERR! react-scripts@"5.0.1" from @hyperledger/[email protected]
# npm ERR! examples/cactus-example-cbdc-bridging-frontend
# npm ERR! @hyperledger/[email protected]
# npm ERR! node_modules/@hyperledger/cacti-example-cbdc-bridging-frontend
# npm ERR! workspace examples/cactus-example-cbdc-bridging-frontend from the root project
# npm ERR!
# npm ERR! Fix the upstream dependency conflict, or retry
# npm ERR! this command with --force or --legacy-peer-deps
# npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
- name: wipe_non_yaml_sources
run: rm -rf packages/ examples/ extensions/ package.json

- name: actionlint
id: actionlint
uses: raven-actions/[email protected]
with:
version: 1.6.27
cache: true

- name: actionlint_summary
if: ${{ steps.actionlint.outputs.exit-code != 0 }} # example usage, do echo only when actionlint action failed
run: |

Check failure on line 60 in .github/workflows/actionlint.yaml

View workflow job for this annotation

GitHub Actions / ActionLint / Lint_GitHub_Actions

shellcheck reported issue in this script: SC2242:error:8:6: Can only exit with status 0-255. Other data should be written to stdout/stderr
echo "Used actionlint version ${{ steps.actionlint.outputs.version-semver }}"
echo "Used actionlint release ${{ steps.actionlint.outputs.version-tag }}"
echo "actionlint ended with ${{ steps.actionlint.outputs.exit-code }} exit code"
echo "actionlint ended because '${{ steps.actionlint.outputs.exit-message }}'"
echo "actionlint found ${{ steps.actionlint.outputs.total-errors }} errors"
echo "actionlint checked ${{ steps.actionlint.outputs.total-files }} files"
echo "actionlint cache used: ${{ steps.actionlint.outputs.cache-hit }}"
exit ${{ steps.actionlint.outputs.exit-code }}

0 comments on commit 7951784

Please sign in to comment.