Skip to content

Commit

Permalink
Adds actionlint to lint GitHub Actions workflows (#4326)
Browse files Browse the repository at this point in the history
  • Loading branch information
JayShortway authored Oct 15, 2024
1 parent d275ba8 commit b3a600e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/actionlint-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "actionlint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}
19 changes: 19 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint GitHub Actions workflows
on:
push:
branches: [main]
paths: ['.github/workflows/**']
pull_request:
paths: ['.github/workflows/**']

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Enable the actionlint matcher
run: echo "::add-matcher::.github/actionlint-matcher.json"
- name: Lint GitHub Actions workflows
uses: docker://rhysd/actionlint:latest
with:
args: -color
2 changes: 1 addition & 1 deletion .github/workflows/trigger_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#cli-tools

- id: 'get-branch' # the id here is important since it gets reused in the next step
run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')
run: echo "branch=$(gh pr view "$PR_NO" --repo "$REPO" --json headRefName --jq '.headRefName')" >> "$GITHUB_OUTPUT"
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
Expand Down

0 comments on commit b3a600e

Please sign in to comment.