Skip to content

Commit 4046f4a

Browse files
committed
ci: add GitHub Actions linter
1 parent 91b02f7 commit 4046f4a

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Generated by Gabo (https://github.com/ashishb/gabo)
2+
---
3+
# Run this locally with act - https://github.com/nektos/act
4+
# act -j lintGitHubActions
5+
name: Lint GitHub Actions
6+
7+
on: # yamllint disable-line rule:truthy
8+
push:
9+
branches: [master, main]
10+
paths:
11+
- ".github/workflows/**.yml"
12+
- ".github/workflows/**.yaml"
13+
pull_request:
14+
branches: [master, main]
15+
paths:
16+
- ".github/workflows/**.yml"
17+
- ".github/workflows/**.yaml"
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
lintGitHubActionsWithActionLint:
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 15
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
persist-credentials: false
37+
sparse-checkout: |
38+
.github/workflows
39+
sparse-checkout-cone-mode: false
40+
41+
- name: Lint GitHub Actions
42+
uses: reviewdog/action-actionlint@v1
43+
44+
- name: Check GitHub Actions with 'actionlint'
45+
# Ref: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
46+
# shellcheck is too noisy and disabled
47+
run: |
48+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
49+
./actionlint -color -shellcheck=
50+
shell: bash
51+
52+
53+
lintGitHubActionsForSecurity:
54+
runs-on: ubuntu-latest
55+
timeout-minutes: 15
56+
57+
permissions:
58+
security-events: write
59+
contents: read
60+
actions: read
61+
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
with:
66+
persist-credentials: false
67+
sparse-checkout: |
68+
.github/workflows
69+
sparse-checkout-cone-mode: false
70+
71+
- name: Setup Rust
72+
uses: actions-rust-lang/setup-rust-toolchain@v1
73+
74+
- name: Install zizmor
75+
run: cargo install zizmor
76+
77+
- name: Run zizmor on GitHub Actions
78+
run: zizmor .github/workflows/*

0 commit comments

Comments
 (0)