Skip to content

Commit 2b400c8

Browse files
authored
ci: actions hardening (#158)
* ci: actions hardening * fix hash * fix workflow rename
1 parent ef9f050 commit 2b400c8

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build
1+
name: CI
22

33
on:
44
push:
@@ -16,9 +16,14 @@ concurrency:
1616
group: ${{ github.ref }}
1717
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
1818

19+
permissions: {}
20+
1921
jobs:
2022
test:
2123
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
actions: write
2227

2328
steps:
2429
- uses: actions/checkout@v6
@@ -43,6 +48,7 @@ jobs:
4348
runs-on: ubuntu-latest
4449

4550
permissions:
51+
contents: read
4652
packages: write
4753

4854
env:
@@ -57,7 +63,7 @@ jobs:
5763

5864
- name: Docker meta
5965
id: meta
60-
uses: docker/metadata-action@v5
66+
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
6167
with:
6268
images: |
6369
${{ env.IMAGENAME }}
@@ -71,13 +77,13 @@ jobs:
7177
type=sha
7278
7379
- name: Set up QEMU
74-
uses: docker/setup-qemu-action@v3
80+
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
7581

7682
- name: Set up Docker Buildx
77-
uses: docker/setup-buildx-action@v3
83+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
7884

7985
- name: Login to DockerHub
80-
uses: docker/login-action@v3
86+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
8187
with:
8288
registry: ${{ env.REGISTRY }}
8389
username: ${{ github.actor }}
@@ -92,7 +98,7 @@ jobs:
9298
echo "VERSION=$VERSION" >> $GITHUB_ENV
9399
94100
- name: Build and push Docker images
95-
uses: docker/build-push-action@v6
101+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
96102
with:
97103
context: .
98104
build-args: |
@@ -108,6 +114,9 @@ jobs:
108114
event_file:
109115
name: "Event File"
110116
runs-on: ubuntu-latest
117+
permissions:
118+
actions: write
119+
111120
steps:
112121
- name: Upload
113122
uses: actions/upload-artifact@v7

.github/workflows/test-results.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test Results
22

33
on:
44
workflow_run:
5-
workflows: ["build"]
5+
workflows: ["CI"]
66
types:
77
- completed
88
permissions: {}
@@ -30,15 +30,15 @@ jobs:
3030

3131
steps:
3232
- name: Download and Extract Artifacts
33-
uses: dawidd6/action-download-artifact@v16
33+
uses: dawidd6/action-download-artifact@8305c0f1062bb0d184d09ef4493ecb9288447732 # v20
3434
with:
3535
run_id: ${{ github.event.workflow_run.id }}
3636
path: artifacts
3737
name: (Event File)|(Test Results)
3838
name_is_regexp: true
3939

4040
- name: Publish Test Results
41-
uses: EnricoMi/publish-unit-test-result-action@v2
41+
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0
4242
with:
4343
commit: ${{ github.event.workflow_run.head_sha }}
4444
event_file: artifacts/Event File/event.json

0 commit comments

Comments
 (0)