Skip to content

Commit 7701b54

Browse files
committed
ci: improve GitHub Actions
1 parent 706d9b8 commit 7701b54

File tree

5 files changed

+52
-34
lines changed

5 files changed

+52
-34
lines changed

.github/workflows/lint-github-actions.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}
2121
cancel-in-progress: true
2222

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+
2327
jobs:
2428
lintGitHubActionsWithActionLint:
2529
runs-on: ubuntu-latest
@@ -35,7 +39,7 @@ jobs:
3539
sparse-checkout-cone-mode: false
3640

3741
- name: Lint GitHub Actions
38-
uses: reviewdog/action-actionlint@v1
42+
uses: reviewdog/action-actionlint@a5524e1c19e62881d79c1f1b9b6f09f16356e281 # v1.65.2
3943

4044
- name: Check GitHub Actions with 'actionlint'
4145
# Ref: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
@@ -64,11 +68,5 @@ jobs:
6468
.github/workflows
6569
sparse-checkout-cone-mode: false
6670

67-
- name: Setup Rust
68-
uses: actions-rust-lang/setup-rust-toolchain@v1
69-
70-
- name: Install zizmor
71-
run: cargo install zizmor
72-
7371
- name: Run zizmor on GitHub Actions
74-
run: zizmor .github/workflows/*
72+
run: docker run --rm --network none -v "$PWD":/work:ro ghcr.io/woodruffw/zizmor:latest --offline /work/.github/workflows

.github/workflows/lint-markdown.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
1+
# Generated by Gabo (https://github.com/ashishb/gabo)
12
---
23
# Run this locally with act - https://github.com/nektos/act
34
# act -j lintMarkdown
45
name: Lint Markdown
56

67
on: # yamllint disable-line rule:truthy
78
push:
8-
branches: [master, main]
9+
branches: [main, master]
910
paths:
10-
- '**.md'
11-
- '.github/workflows/lint-markdown.yaml'
11+
- "**.md"
12+
- ".github/workflows/lint-markdown.yaml"
1213
pull_request:
13-
branches: [master, main]
14+
branches: [main, master]
1415
paths:
15-
- '**.md'
16-
- '.github/workflows/lint-markdown.yaml'
16+
- "**.md"
17+
- ".github/workflows/lint-markdown.yaml"
1718

1819
concurrency:
1920
group: ${{ github.workflow }}-${{ github.ref }}
2021
cancel-in-progress: true
2122

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+
2227
jobs:
2328
lintMarkdown:
2429
runs-on: ubuntu-latest
2530
timeout-minutes: 15
2631

2732
steps:
28-
- name: Checkout code
33+
- name: Checkout repository
2934
uses: actions/checkout@v6
3035
with:
3136
persist-credentials: false
3237

3338
- name: Set up Ruby
3439
# See https://github.com/ruby/setup-ruby#versioning
35-
uses: ruby/setup-ruby@v1
40+
uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
3641
with:
3742
ruby-version: 3.0
3843

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1+
# Generated by Gabo (https://github.com/ashishb/gabo)
12
---
23
# Run this locally with act - https://github.com/nektos/act
34
# act -j lintShellScript
45
name: Lint Shell scripts
56

67
on: # yamllint disable-line rule:truthy
7-
workflow_dispatch:
88
push:
9-
branches: [master, main]
9+
branches: [main, master]
1010
paths:
11-
- '**.sh'
12-
- '**.bash'
13-
- '.github/workflows/lint-shell-script.yaml'
11+
- "**.sh"
12+
- "**.bash"
13+
- ".github/workflows/lint-shell-script.yaml"
1414
pull_request:
15-
branches: [master, main]
15+
branches: [main, master]
1616
paths:
17-
- '**.sh'
18-
- '**.bash'
19-
- '.github/workflows/lint-shell-script.yaml'
17+
- "**.sh"
18+
- "**.bash"
19+
- ".github/workflows/lint-shell-script.yaml"
2020

2121
concurrency:
2222
group: ${{ github.workflow }}-${{ github.ref }}
2323
cancel-in-progress: true
2424

25+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
26+
permissions:
27+
contents: read
28+
2529
jobs:
2630

2731
lintShellScript:
2832
runs-on: ubuntu-latest
2933
timeout-minutes: 15
3034

3135
steps:
32-
- name: Checkout code
36+
- name: Checkout repository
3337
uses: actions/checkout@v6
3438
with:
3539
persist-credentials: false
3640

3741
- name: Run ShellCheck
38-
uses: ludeeus/action-shellcheck@2.0.0
42+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0

.github/workflows/lint-yaml.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
1+
# Generated by Gabo (https://github.com/ashishb/gabo)
12
---
23
# Run this locally with act - https://github.com/nektos/act
34
# act -j lintYaml
45
name: Lint YAML
56

67
on: # yamllint disable-line rule:truthy
78
push:
8-
branches: [master, main]
9+
branches: [main, master]
910
paths:
1011
- '**.yml'
1112
- '**.yaml'
1213
- '.github/workflows/**.yml'
1314
- '.github/workflows/**.yaml'
1415
pull_request:
15-
branches: [master, main]
16+
branches: [main, master]
1617
paths:
17-
- '**.yml'
18-
- '**.yaml'
19-
- '.github/workflows/**.yml'
20-
- '.github/workflows/**.yaml'
18+
- "**.yml"
19+
- "**.yaml"
20+
- ".github/workflows/**.yml"
21+
- ".github/workflows/**.yaml"
2122

2223
concurrency:
2324
group: ${{ github.workflow }}-${{ github.ref }}
2425
cancel-in-progress: true
2526

27+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
28+
permissions:
29+
contents: read
30+
2631
jobs:
2732
lintYaml:
2833
runs-on: ubuntu-latest
@@ -35,7 +40,7 @@ jobs:
3540
persist-credentials: false
3641

3742
- name: Check YAML files with linter
38-
uses: ibiqlik/action-yamllint@v3
43+
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
3944
with:
4045
# All files under base dir
4146
file_or_dir: "."
@@ -53,3 +58,6 @@ jobs:
5358
level: warning
5459
trailing-spaces:
5560
level: warning
61+
62+
- name: Lint GitHub Actions
63+
uses: reviewdog/action-actionlint@a5524e1c19e62881d79c1f1b9b6f09f16356e281 # v1.65.2

.github/workflows/validate-links.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}
2121
cancel-in-progress: true
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427

2528
validateLinks:

0 commit comments

Comments
 (0)