Skip to content

Commit 4b0b19a

Browse files
committed
ci: harden GH Actions, pin versions to commits
1 parent e7eedf0 commit 4b0b19a

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

.github/workflows/check-pull-request.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@v5
26+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2727
with:
2828
fetch-depth: 0
2929

3030
- name: Setup npm
31-
uses: actions/setup-node@v5
31+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3232
with:
3333
node-version: 24.18
3434
cache: npm
3535

3636
- name: Install and audit
3737
run: |
3838
npm audit --omit=dev
39-
npm ci
39+
npm ci --ignore-scripts
4040
npm run postinstall
4141
4242
- name: Verify semantic version bump
@@ -71,13 +71,15 @@ jobs:
7171
- name: Jest Coverage Comment (with base snapshot)
7272
if: steps.base-cov.outputs.available == 'true'
7373
uses: ArtiomTr/jest-coverage-report-action@v2
74+
# NOTE: need to switch to vitest!
7475
with:
7576
test-script: npm test
7677
base-coverage-file: base-coverage/report.json
7778

7879
- name: Jest Coverage Comment (no base snapshot)
7980
if: steps.base-cov.outputs.available != 'true'
8081
uses: ArtiomTr/jest-coverage-report-action@v2
82+
# NOTE: need to switch to vitest!
8183
with:
8284
test-script: npm test
8385

@@ -88,9 +90,9 @@ jobs:
8890
# TODO: re-enable mTLS tests when startup health check issue is resolved
8991
# && npm run test:acceptance:proxy:mtls
9092

91-
- name: Sonarqube Cloud Scan
93+
- name: Sonar Cloud Scan
9294
if: github.actor != 'dependabot[bot]'
93-
uses: SonarSource/sonarqube-scan-action@v6
95+
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1
9496
env:
9597
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9698
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/publish-hotfix.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,30 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Check out code
21-
uses: actions/checkout@v5
21+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2222
with:
2323
fetch-depth: 0 # Depth 0 is required for branch-based versioning
2424

2525
- name: Test code and Create Test Coverage Reports
26-
uses: actions/setup-node@v5
26+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2727
with:
2828
node-version: 24
2929
cache: npm
3030
- run: |
3131
npm audit --omit=dev
32-
npm ci
32+
npm ci --ignore-scripts
3333
npm run postinstall
3434
npm run lint
3535
npm test
3636
3737
- name: Publish Hot Fix
38-
uses: DEFRA/cdp-build-action/build-hotfix@main
38+
uses: DEFRA/cdp-build-action/build-hotfix@f13fc42004f99a1df2e21ce1ff488cc72c897e40 # 17 Jul 2026
3939
with:
4040
github-token: ${{ secrets.GITHUB_TOKEN }}
4141

42+
# FIXME: this step should be run before the tag publishing in case there are problems found!
4243
- name: SonarCloud Scan
43-
uses: SonarSource/sonarqube-scan-action@v6
44+
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1
4445
env:
4546
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4647
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ jobs:
1919
name: Snapshot base coverage for PR comparison
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v5
23-
- uses: actions/setup-node@v5
22+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
23+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2424
with:
2525
node-version: 24
2626
cache: npm
2727
- run: |
28-
npm ci
28+
npm ci --ignore-scripts
2929
npm run postinstall
3030
- name: Run unit + graphql tests with coverage
3131
run: npm test -- --ci --json --testLocationInResults --outputFile=report.json
32-
- uses: actions/upload-artifact@v4
32+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3333
with:
3434
name: coverage-report-main
3535
path: report.json
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
steps:
4343
- name: Check out code
44-
uses: actions/checkout@v5
44+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4545
with:
4646
fetch-depth: 0
4747

@@ -56,7 +56,7 @@ jobs:
5656
echo "value=${VERSION}" >> $GITHUB_OUTPUT
5757
5858
- name: Build and Publish
59-
uses: DEFRA/cdp-build-action/build@main
59+
uses: DEFRA/cdp-build-action/build@f13fc42004f99a1df2e21ce1ff488cc72c897e40 # 17 Jul 2026
6060
with:
6161
github-token: ${{ secrets.GITHUB_TOKEN }}
6262
version: ${{ steps.version.outputs.value }}
@@ -67,7 +67,7 @@ jobs:
6767
git push --tags
6868
6969
- name: SonarCloud Scan
70-
uses: SonarSource/sonarqube-scan-action@v6
70+
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1
7171
env:
7272
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7373
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)