Skip to content

Commit 30a408f

Browse files
raych1Copilot
andauthored
Add actionlint workflow to lint GitHub Actions workflows (Azure#49563)
Add actionlint configuration, problem matcher, and workflow to automatically lint GitHub Actions workflow files on pushes to main and pull requests that modify .github/ files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 78bb953 commit 30a408f

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/actionlint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
self-hosted-runner:
2+
labels:
3+
- 1ES.Pool=azsdk-pool-github-runners

.github/matchers/actionlint.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"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)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/workflows/actionlint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Actionlint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/**
9+
pull_request:
10+
paths:
11+
- .github/**
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
with:
25+
sparse-checkout: |
26+
.github
27+
28+
# Content copied from https://raw.githubusercontent.com/rhysd/actionlint/2ab3a12c7848f6c15faca9a92612ef4261d0e370/.github/actionlint-matcher.json
29+
- name: Add ActionLint Problem Matcher
30+
run: echo "::add-matcher::.github/matchers/actionlint.json"
31+
32+
- name: Lint workflows
33+
uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
34+
with:
35+
args: -color -verbose

0 commit comments

Comments
 (0)