Skip to content

Commit 2da7195

Browse files
authored
[repo] GitHub Actions hardening (#2671)
1 parent 3698be9 commit 2da7195

17 files changed

+38
-38
lines changed

.github/workflows/Component.BuildTest.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
runs-on: ${{ matrix.os }}
5555

5656
steps:
57-
- uses: actions/checkout@v4
57+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5858
with:
5959
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
6060
# the version tag which is typically NOT on the first commit so we
@@ -89,7 +89,7 @@ jobs:
8989
echo "BUILD_COMPONENT=$component" >> $env:GITHUB_ENV
9090
9191
- name: Setup dotnet
92-
uses: actions/setup-dotnet@v4
92+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
9393

9494
- name: dotnet restore ${{ steps.resolve-project.outputs.title }}
9595
run: dotnet restore ${{ steps.resolve-project.outputs.project }} -p:EnablePackageValidation=true
@@ -127,7 +127,7 @@ jobs:
127127

128128
- name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
129129
if: ${{ inputs.run-tests && hashFiles('./TestResults/Cobertura.xml') != '' }}
130-
uses: codecov/codecov-action@v5
130+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
131131
continue-on-error: true # Note: Don't fail for upload failures
132132
env:
133133
OS: ${{ matrix.os }}

.github/workflows/add-labels.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: check out code
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2222

2323
- name: Add labels for component found in bug issue descriptions
2424
shell: pwsh
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: check out code
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4444
with:
4545
ref: ${{ github.event.repository.default_branch }} # Note: Do not run on the PR branch we want to execute add-labels.psm1 from main on the base repo only because pull_request_target can see secrets
4646

.github/workflows/assign-reviewers.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010
runs-on: ubuntu-22.04
1111
name: Assign Reviewers
1212
steps:
13-
- uses: dyladan/component-owners@main
13+
- uses: dyladan/component-owners@58bd86e9814d23f1525d0a970682cead459fa783 # v0.1.0
1414
with:
1515
assign-owners: ${{ github.event.pull_request.draft == false }}

.github/workflows/ci-Exporter.OneCollector-Integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ jobs:
3636

3737
runs-on: ${{ matrix.os }}
3838
steps:
39-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4040
with:
4141
ref: ${{ github.event.pull_request.head.sha || github.ref }} # Run on the fork branch once approved
4242

4343
- name: Setup dotnet
44-
uses: actions/setup-dotnet@v4
44+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
4545

4646
- name: dotnet restore Component.proj for OpenTelemetry.Exporter.OneCollector
4747
run: dotnet restore build/Projects/Component.proj -p:BUILD_COMPONENT=OpenTelemetry.Exporter.OneCollector

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
outputs:
1414
changes: ${{ steps.changes.outputs.changes }}
1515
steps:
16-
- uses: AurorNZ/paths-filter@v4
16+
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 # v4.0.0
1717
id: changes
1818
with:
1919
filters: |

.github/workflows/codeql-analysis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@ jobs:
2222

2323
steps:
2424
- name: configure Pagefile
25-
uses: al-cheb/[email protected]
25+
uses: al-cheb/configure-pagefile-action@a3b6ebd6b634da88790d9c58d4b37a7f4a7b8708 # v1.4
2626
with:
2727
minimum-size: 8GB
2828
maximum-size: 32GB
2929
disk-root: "D:"
3030

3131
- name: Checkout repository
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3333

3434
- name: Initialize CodeQL
35-
uses: github/codeql-action/init@v3
35+
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
3636
with:
3737
languages: ${{ matrix.language }}
3838

3939
- name: Setup dotnet
40-
uses: actions/setup-dotnet@v4
40+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
4141

4242
- name: dotnet pack opentelemetry-dotnet-contrib.proj
4343
run: dotnet pack opentelemetry-dotnet-contrib.proj --configuration Release
4444

4545
- name: Perform CodeQL Analysis
46-
uses: github/codeql-action/analyze@v3
46+
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13

.github/workflows/core-version-update.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
2525

2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2828
with:
2929
ref: ${{ github.event.repository.default_branch }}
3030
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
3131

3232
- name: Setup dotnet
33-
uses: actions/setup-dotnet@v4
33+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
3434

3535
- name: Create GitHub Pull Request to update core version in props and update CHANGELOGs in projects
3636
shell: pwsh

.github/workflows/dotnet-format.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99

1010
steps:
1111
- name: check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1313

1414
- name: Setup dotnet
15-
uses: actions/setup-dotnet@v4
15+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
1616

1717
- name: dotnet restore
1818
run: dotnet restore

.github/workflows/integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
version: [net8.0]
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2020

2121
- name: Run redis docker compose
2222
run: docker compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
@@ -29,7 +29,7 @@ jobs:
2929
matrix:
3030
version: [net8.0]
3131
steps:
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3333

3434
- name: Run kafka docker compose
3535
run: docker compose --file=test/OpenTelemetry.Instrumentation.ConfluentKafka.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build

.github/workflows/markdownlint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99

1010
steps:
1111
- name: check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1313

1414
- name: run markdownlint
15-
uses: DavidAnson/[email protected]
15+
uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19.1.0
1616
with:
1717
globs: |
1818
**/*.md

.github/workflows/post-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
2828

2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3131
with:
3232
# Note: By default GitHub only fetches 1 commit. We need all the tags
3333
# for this work.

.github/workflows/prepare-release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191

9292
steps:
9393
- name: check out code
94-
uses: actions/checkout@v4
94+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9595
with:
9696
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
9797

@@ -128,7 +128,7 @@ jobs:
128128

129129
steps:
130130
- name: check out code
131-
uses: actions/checkout@v4
131+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
132132
with:
133133
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
134134

@@ -162,7 +162,7 @@ jobs:
162162

163163
steps:
164164
- name: check out code
165-
uses: actions/checkout@v4
165+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
166166
with:
167167
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
168168
fetch-depth: 0
@@ -201,7 +201,7 @@ jobs:
201201

202202
steps:
203203
- name: check out code
204-
uses: actions/checkout@v4
204+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
205205
with:
206206
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
207207
fetch-depth: 0
@@ -244,7 +244,7 @@ jobs:
244244

245245
steps:
246246
- name: check out code
247-
uses: actions/checkout@v4
247+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
248248
with:
249249
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
250250

.github/workflows/publish-packages.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
artifact-id: ${{ steps.upload-artifacts.outputs.artifact-id }}
3030

3131
steps:
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3333
with:
3434
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
3535
# the version tag which is typically NOT on the first commit so we
@@ -67,7 +67,7 @@ jobs:
6767
echo "BUILD_COMPONENT=$component" >> $env:GITHUB_ENV
6868
6969
- name: Setup dotnet
70-
uses: actions/setup-dotnet@v4
70+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
7171

7272
- name: dotnet restore ${{ steps.resolve-project.outputs.title }}
7373
run: dotnet restore ${{ steps.resolve-project.outputs.project }}
@@ -83,7 +83,7 @@ jobs:
8383

8484
- name: Publish Artifacts
8585
id: upload-artifacts
86-
uses: actions/upload-artifact@v4
86+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8787
with:
8888
name: ${{ github.ref_name }}-packages
8989
path: 'src\**\*.*nupkg'
@@ -117,7 +117,7 @@ jobs:
117117

118118
steps:
119119
- name: check out code
120-
uses: actions/checkout@v4
120+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
121121
with:
122122
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
123123

.github/workflows/sanitycheck.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
steps:
1111
- name: check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1313

1414
- name: install misspell
1515
run: |
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: check out code
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2828

2929
- name: detect non-ASCII encoding and trailing space
3030
run: python3 ./build/scripts/sanitycheck.py

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
stale:
1111
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/stale@v9
13+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
1414
with:
1515
stale-pr-message: 'This PR was marked stale due to lack of activity. It will be closed in 7 days.'
1616
close-pr-message: 'Closed as inactive. Feel free to reopen if this PR is still being worked on.'

.github/workflows/verifyaotcompat.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414

1515
runs-on: ${{ matrix.os }}
1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818

1919
- name: Setup dotnet
20-
uses: actions/setup-dotnet@v4
20+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
2121

2222
- name: publish AOT testApp, assert static analysis warning count, and run the app
2323
shell: pwsh

.github/workflows/yamllint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
steps:
1111
- name: check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1313

1414
- name: install yamllint
1515
run: pip install yamllint

0 commit comments

Comments
 (0)