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 <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Apr 3, 2024
1 parent f71c48e commit 32db5fb
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions .github/workflows/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,36 @@ on:
workflow_call:

jobs:
actionlint:
Lint_GitHub_Actions:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.1
- 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
# - uses: actions/checkout@v4.1.1
# - 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: actionlint
id: actionlint #optional, id required only when outputs are used in the workflow steps later
uses: raven-actions/actionlint@v1.0.3
with:
version: 1.6.27
# matcher: false # optional
# cache: false # optional
# fail-on-error: false # optional
# files: "tests/*.yml, tests/*.yaml" # optional, example on how to grab all .yml and .yaml files from the test directory
# flags: "-ignore SC2086" # optional

- name: actionlint_summary
if: ${{ steps.actionlint.outputs.exit-code != 0 }} # example usage, do echo only when actionlint action failed
run: |
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 32db5fb

Please sign in to comment.