Skip to content

Commit 1539fbb

Browse files
committed
ci(.github): pin actions to commit-hash; set permissions at job level
1 parent df7f363 commit 1539fbb

File tree

5 files changed

+46
-115
lines changed

5 files changed

+46
-115
lines changed

.github/workflows/automerge.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/cd.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- name: Release Please
2424
id: release
25-
uses: googleapis/release-please-action@v4
25+
uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
2626
with:
2727
config-file: .github/release-please/config.json
2828
manifest-file: .github/release-please/manifest.json
@@ -38,12 +38,12 @@ jobs:
3838
id-token: write
3939
steps:
4040
- name: Check out repo
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4242
with:
4343
persist-credentials: false
4444

4545
- name: Setup Node
46-
uses: actions/setup-node@v4
46+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
4747
with:
4848
check-latest: true
4949
node-version: lts/*
@@ -72,12 +72,12 @@ jobs:
7272
packages: write
7373
steps:
7474
- name: Check out repo
75-
uses: actions/checkout@v4
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7676
with:
7777
persist-credentials: false
7878

7979
- name: Setup Node
80-
uses: actions/setup-node@v4
80+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
8181
with:
8282
check-latest: true
8383
node-version: lts/*

.github/workflows/ci.yml

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ on:
1818
- "*.md"
1919
types: [opened, ready_for_review, reopened, synchronize]
2020

21-
permissions:
22-
contents: read
23-
2421
# This allows a subsequently queued workflow run to interrupt previous runs
2522
concurrency:
2623
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
@@ -33,27 +30,31 @@ jobs:
3330
github.event.pull_request.draft == false &&
3431
github.event_name == 'pull_request'
3532
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
3635
steps:
3736
- name: Check out repo
38-
uses: actions/checkout@v4
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3938
with:
4039
persist-credentials: false
4140

4241
- name: Dependency review
43-
uses: actions/dependency-review-action@v4
42+
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
4443

4544
lint:
4645
name: Lint Code
4746
if: github.event.pull_request.draft == false
4847
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
4950
steps:
5051
- name: Check out repo
51-
uses: actions/checkout@v4
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5253
with:
5354
persist-credentials: false
5455

5556
- name: Setup Node
56-
uses: actions/setup-node@v4
57+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
5758
with:
5859
check-latest: true
5960
node-version: lts/*
@@ -82,15 +83,17 @@ jobs:
8283
github.event.pull_request.draft == false &&
8384
github.actor != 'dependabot[bot]'
8485
runs-on: ubuntu-latest
86+
permissions:
87+
contents: read
8588
steps:
8689
- name: Check out repo
87-
uses: actions/checkout@v4
90+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8891
with:
8992
fetch-depth: 0
9093
persist-credentials: false
9194

9295
- name: Run Commitlint
93-
uses: wagoid/commitlint-github-action@v6
96+
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
9497
with:
9598
configFile: ./package.json
9699

@@ -102,14 +105,16 @@ jobs:
102105
node-version: [20, 22]
103106
os: [macos-latest, ubuntu-latest, windows-latest]
104107
runs-on: ${{ matrix.os }}
108+
permissions:
109+
contents: read
105110
steps:
106111
- name: Check out repo
107-
uses: actions/checkout@v4
112+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
108113
with:
109114
persist-credentials: false
110115

111116
- name: Setup Node ${{ matrix.node-version }}
112-
uses: actions/setup-node@v4
117+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
113118
with:
114119
node-version: ${{ matrix.node-version }}
115120

@@ -120,8 +125,8 @@ jobs:
120125
run: npm run test:unit:coverage
121126

122127
- name: Coveralls parallel
123-
if: github.repository == 'Fdawgs/fastify-disablecache'
124-
uses: coverallsapp/github-action@v2
128+
if: github.repository == 'Fdawgs/fastify-json-to-xml'
129+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
125130
with:
126131
github-token: ${{ secrets.GITHUB_TOKEN }}
127132
parallel: true
@@ -132,37 +137,30 @@ jobs:
132137
needs: unit-tests
133138
if: >
134139
github.event.pull_request.draft == false &&
135-
github.repository == 'Fdawgs/fastify-disablecache'
140+
github.repository == 'Fdawgs/fastify-json-to-xml'
136141
runs-on: ubuntu-latest
142+
permissions:
143+
contents: read
137144
steps:
138145
- name: Coveralls finished
139-
uses: coverallsapp/github-action@v2
146+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
140147
with:
141148
github-token: ${{ secrets.GITHUB_TOKEN }}
142149
parallel-finished: true
143150

144-
# This job is used to save the PR number in an artifact, for use in the automerge.yml workflow
145-
save-pr-number:
146-
name: Save Dependabot PR Number
151+
automerge:
152+
name: Automerge Dependabot PRs
147153
needs: unit-tests
148154
if: >
149155
github.event.pull_request.draft == false &&
150156
github.event_name == 'pull_request' &&
151157
github.event.pull_request.user.login == 'dependabot[bot]'
152158
runs-on: ubuntu-latest
159+
permissions:
160+
pull-requests: write
161+
contents: write
153162
steps:
154-
- name: Check out repo
155-
uses: actions/checkout@v4
163+
- uses: fastify/github-action-merge-dependabot@e820d631adb1d8ab16c3b93e5afe713450884a4a # v3.11.1
156164
with:
157-
persist-credentials: false
158-
159-
- name: Save PR number
160-
run: |
161-
mkdir -p ./pr
162-
echo ${{ github.event.number }} > ./pr/NR
163-
164-
- name: Upload PR number in artifact
165-
uses: actions/upload-artifact@v4
166-
with:
167-
name: pr
168-
path: pr/
165+
github-token: ${{ secrets.GITHUB_TOKEN }}
166+
merge-method: squash

.github/workflows/codeql.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@ on:
1616
- "**/*.yml"
1717
types: [opened, ready_for_review, reopened, synchronize]
1818

19-
permissions:
20-
security-events: write
21-
2219
# This allows a subsequently queued workflow run to interrupt previous runs
2320
concurrency:
2421
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
2522
cancel-in-progress: true
2623

2724
jobs:
2825
build:
26+
name: CodeQL Analysis
2927
if: github.event.pull_request.draft == false
3028
runs-on: ubuntu-latest
29+
permissions:
30+
security-events: write
3131
steps:
3232
- name: Check out repo
33-
uses: actions/checkout@v4
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3434
with:
3535
persist-credentials: false
3636

3737
# Initialises the CodeQL tools for scanning
3838
- name: Initialise CodeQL
39-
uses: github/codeql-action/init@v3
39+
uses: github/codeql-action/init@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
4040
with:
41-
languages: javascript
41+
languages: javascript-typescript
4242
config-file: ./.github/codeql-config.yml
4343

4444
- name: Perform CodeQL analysis
45-
uses: github/codeql-action/analyze@v3
45+
uses: github/codeql-action/analyze@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12

.github/workflows/link-check.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,21 @@ on:
3131
# Allows this workflow to be run manually from the Actions tab
3232
workflow_dispatch:
3333

34-
permissions:
35-
contents: read
36-
3734
jobs:
3835
link-check:
3936
name: Link Check
4037
if: github.event.pull_request.draft == false
4138
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
4241
steps:
4342
- name: Check out repo
44-
uses: actions/checkout@v4
43+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4544
with:
4645
persist-credentials: false
4746

4847
- name: Run Linkinator
49-
uses: JustinBeckwith/linkinator-action@v1
48+
uses: JustinBeckwith/linkinator-action@3d5ba091319fa7b0ac14703761eebb7d100e6f6d # v1.11.0
5049
with:
5150
paths: "**/*.md"
5251
skip: "https://(?:www.|)github.com/Fdawgs/.*/(?:commit|issues|compare)/, http://0.0.0.0"

0 commit comments

Comments
 (0)