Skip to content

Commit 454f052

Browse files
committed
pin GitHub Actions to full commit SHAs and rework actions shas to own block
. Improves #3029
1 parent a09a027 commit 454f052

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

.github/workflows/checks.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,26 @@ on:
1010
workflow_dispatch:
1111

1212
permissions:
13-
contents: read # to fetch code (actions/checkout)
13+
contents: read # to fetch code (actions/checkout)
1414

1515
env:
16-
# run static analysis only with the latest Go version
1716
LATEST_GO_VERSION: "1.26"
1817

18+
# https://github.com/actions/checkout/commit/df4cb1c069e1874edd31b4311f1884172cec0e10
19+
CHECKOUT_ACTION: &checkout_action actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
20+
21+
# https://github.com/actions/setup-go/commit/924ae3a1cded613372ab5595356fb5720e22ba16
22+
SETUP_GO_ACTION: &setup_go_action actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
23+
1924
jobs:
2025
check:
2126
runs-on: ubuntu-latest
2227
steps:
2328
- name: Checkout Code
24-
uses: actions/checkout@v6
29+
uses: *checkout_action
2530

26-
- name: Set up Go ${{ matrix.go }}
27-
uses: actions/setup-go@v6
31+
- name: Set up Go
32+
uses: *setup_go_action
2833
with:
2934
go-version: ${{ env.LATEST_GO_VERSION }}
3035
check-latest: true
@@ -44,4 +49,3 @@ jobs:
4449
go version
4550
go install golang.org/x/vuln/cmd/govulncheck@latest
4651
govulncheck ./...
47-

.github/workflows/echo.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ on:
1010
workflow_dispatch:
1111

1212
permissions:
13-
contents: read # to fetch code (actions/checkout)
13+
contents: read # to fetch code (actions/checkout)
1414

1515
env:
16-
# run coverage and benchmarks only with the latest Go version
1716
LATEST_GO_VERSION: "1.26"
1817

18+
# https://github.com/actions/checkout/commit/df4cb1c069e1874edd31b4311f1884172cec0e10
19+
CHECKOUT_ACTION: &checkout_action actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
20+
21+
# https://github.com/actions/setup-go/commit/924ae3a1cded613372ab5595356fb5720e22ba16
22+
SETUP_GO_ACTION: &setup_go_action actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
23+
24+
# https://github.com/codecov/codecov-action/commit/fb8b3582c8e4def4969c97caa2f19720cb33a72f
25+
CODECOV_ACTION: &codecov_action codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
26+
1927
jobs:
2028
test:
2129
strategy:
@@ -30,10 +38,10 @@ jobs:
3038
runs-on: ${{ matrix.os }}
3139
steps:
3240
- name: Checkout Code
33-
uses: actions/checkout@v6
41+
uses: *checkout_action
3442

3543
- name: Set up Go ${{ matrix.go }}
36-
uses: actions/setup-go@v6
44+
uses: *setup_go_action
3745
with:
3846
go-version: ${{ matrix.go }}
3947

@@ -42,7 +50,7 @@ jobs:
4250

4351
- name: Upload coverage to Codecov
4452
if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'
45-
uses: codecov/codecov-action@v6
53+
uses: *codecov_action
4654
with:
4755
token:
4856
fail_ci_if_error: false
@@ -53,18 +61,18 @@ jobs:
5361
runs-on: ubuntu-latest
5462
steps:
5563
- name: Checkout Code (Previous)
56-
uses: actions/checkout@v6
64+
uses: *checkout_action
5765
with:
5866
ref: ${{ github.base_ref }}
5967
path: previous
6068

6169
- name: Checkout Code (New)
62-
uses: actions/checkout@v6
70+
uses: *checkout_action
6371
with:
6472
path: new
6573

66-
- name: Set up Go ${{ matrix.go }}
67-
uses: actions/setup-go@v6
74+
- name: Set up Go
75+
uses: *setup_go_action
6876
with:
6977
go-version: ${{ env.LATEST_GO_VERSION }}
7078

0 commit comments

Comments
 (0)