Skip to content

Commit 01a3c5b

Browse files
authored
ci: pin third-party GitHub Actions to commit SHAs (microsoft#5972)
Replaces every floating tag in our workflow and composite action files with an immutable 40-character commit SHA, keeping the original `# vX` comment so Dependabot can still propose version bumps. 186 occurrences across 25 workflows and 2 composite actions. Also widens the github-actions Dependabot entry to use the plural `directories` key with `/.github/actions/*` so composite actions under `.github/actions/<name>/action.yml` are kept up to date. Previously Dependabot only scanned `.github/workflows` and the repo-root `action.yml`, leaving our `python-setup` and `sample-validation-setup` composite actions unmaintained.
1 parent d74d26c commit 01a3c5b

28 files changed

Lines changed: 195 additions & 189 deletions

.github/actions/python-setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
using: "composite"
1818
steps:
1919
- name: Set up uv
20-
uses: astral-sh/setup-uv@v6
20+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
2121
with:
2222
version-file: "python/pyproject.toml"
2323
enable-cache: true

.github/actions/sample-validation-setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
using: "composite"
2525
steps:
2626
- name: Set up Node.js environment
27-
uses: actions/setup-node@v6
27+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
2828
with:
2929
node-version: 22
3030

@@ -37,7 +37,7 @@ runs:
3737
run: copilot --version && copilot -p "What can you do in one sentence?"
3838

3939
- name: Azure CLI Login
40-
uses: azure/login@v2
40+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
4141
with:
4242
client-id: ${{ inputs.azure-client-id }}
4343
tenant-id: ${{ inputs.azure-tenant-id }}

.github/dependabot.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ updates:
4444

4545
# Maintain dependencies for github-actions
4646
- package-ecosystem: "github-actions"
47-
# Workflow files stored in the
48-
# default location of `.github/workflows`
49-
directory: "/"
47+
# Cover both the standard workflow location and our composite actions.
48+
# With `directory: "/"` Dependabot only scans `.github/workflows/*.{yml,yaml}`
49+
# plus a root-level `action.yml/action.yaml`. It does NOT recurse into
50+
# `.github/actions/*/action.yml`, so the glob below is required to keep the
51+
# composite actions in `.github/actions/<name>/` up to date as well.
52+
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#directories-or-directory--
53+
directories:
54+
- "/"
55+
- "/.github/actions/*"
5056
schedule:
5157
interval: "weekly"
5258
day: "sunday"

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232

3333
steps:
3434
- name: Checkout repository
35-
uses: actions/checkout@v6
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3636
with:
3737
persist-credentials: false
3838

3939
# Initializes the CodeQL tools for scanning.
4040
- name: Initialize CodeQL
41-
uses: github/codeql-action/init@v4
41+
uses: github/codeql-action/init@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4
4242
with:
4343
languages: ${{ matrix.language }}
4444
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -51,7 +51,7 @@ jobs:
5151
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5252
# If this step fails, then you should remove it and run the build manually (see below)
5353
- name: Autobuild
54-
uses: github/codeql-action/autobuild@v4
54+
uses: github/codeql-action/autobuild@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4
5555

5656
# ℹ️ Command-line programs to run using the OS shell.
5757
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -64,6 +64,6 @@ jobs:
6464
# ./location_of_script_within_repo/buildscript.sh
6565

6666
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v4
67+
uses: github/codeql-action/analyze@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4
6868
with:
6969
category: "/language:${{matrix.language}}"

.github/workflows/devflow-pr-review.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
6767
- name: Check PR author team membership
6868
id: check
69-
uses: actions/github-script@v8
69+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
7070
env:
7171
TEAM_NAME: ${{ secrets.DEVELOPER_TEAM }}
7272
PR_NUMBER: ${{ steps.pr.outputs.pr_number }}
@@ -116,7 +116,7 @@ jobs:
116116
steps:
117117
# Safe checkout: base repo only, not the untrusted PR head.
118118
- name: Checkout target repo base
119-
uses: actions/checkout@v6
119+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
120120
with:
121121
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.sha }}
122122
fetch-depth: 0
@@ -125,7 +125,7 @@ jobs:
125125

126126
# Private DevFlow checkout: the PAT/token grants access to this repo's code.
127127
- name: Checkout DevFlow
128-
uses: actions/checkout@v6
128+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
129129
with:
130130
repository: ${{ env.DEVFLOW_REPOSITORY }}
131131
ref: ${{ env.DEVFLOW_REF }}
@@ -135,12 +135,12 @@ jobs:
135135
path: devflow
136136

137137
- name: Set up Python
138-
uses: actions/setup-python@v5
138+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
139139
with:
140140
python-version: "3.13"
141141

142142
- name: Set up uv
143-
uses: astral-sh/setup-uv@v7
143+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
144144
with:
145145
version: "0.11.x"
146146
enable-cache: true

.github/workflows/dotnet-build-and-test.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
functionsChanged: ${{ steps.filter.outputs.functions }}
4242
coreChanged: ${{ steps.filter.outputs.core }}
4343
steps:
44-
- uses: actions/checkout@v6
45-
- uses: dorny/paths-filter@v3
44+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
45+
- uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590 # v3
4646
id: filter
4747
with:
4848
filters: |
@@ -111,7 +111,7 @@ jobs:
111111

112112
runs-on: ${{ matrix.os }}
113113
steps:
114-
- uses: actions/checkout@v6
114+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
115115
with:
116116
persist-credentials: false
117117
sparse-checkout: |
@@ -122,7 +122,7 @@ jobs:
122122
declarative-agents
123123
124124
- name: Setup dotnet
125-
uses: actions/setup-dotnet@v5.2.0
125+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
126126
with:
127127
global-json-file: ${{ github.workspace }}/dotnet/global.json
128128
- name: Build dotnet solutions
@@ -181,7 +181,7 @@ jobs:
181181
runs-on: ${{ matrix.os }}
182182
environment: ${{ matrix.environment }}
183183
steps:
184-
- uses: actions/checkout@v6
184+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
185185
with:
186186
persist-credentials: false
187187
sparse-checkout: |
@@ -202,7 +202,7 @@ jobs:
202202
echo "COSMOSDB_EMULATOR_AVAILABLE=true" >> $env:GITHUB_ENV
203203
204204
- name: Setup dotnet
205-
uses: actions/setup-dotnet@v5.2.0
205+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
206206
with:
207207
global-json-file: ${{ github.workspace }}/dotnet/global.json
208208

@@ -271,7 +271,7 @@ jobs:
271271

272272
- name: Azure CLI Login
273273
if: github.event_name != 'pull_request' && matrix.integration-tests
274-
uses: azure/login@v2
274+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
275275
with:
276276
client-id: ${{ secrets.AZURE_CLIENT_ID }}
277277
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -318,15 +318,15 @@ jobs:
318318
# Generate test reports and check coverage
319319
- name: Generate test reports
320320
if: matrix.targetFramework == env.COVERAGE_FRAMEWORK
321-
uses: danielpalme/ReportGenerator-GitHub-Action@5.5.3
321+
uses: danielpalme/ReportGenerator-GitHub-Action@2a82782178b2816d9d6960a7345fdd164791b323 # 5.5.3
322322
with:
323323
reports: "./TestResults/Coverage/**/*.cobertura.xml"
324324
targetdir: "./TestResults/Reports"
325325
reporttypes: "HtmlInline;JsonSummary"
326326

327327
- name: Upload coverage report artifact
328328
if: matrix.targetFramework == env.COVERAGE_FRAMEWORK
329-
uses: actions/upload-artifact@v7
329+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
330330
with:
331331
name: CoverageReport-${{ matrix.os }}-${{ matrix.targetFramework }}-${{ matrix.configuration }} # Artifact name
332332
path: ./TestResults/Reports # Directory containing files to upload
@@ -338,7 +338,7 @@ jobs:
338338

339339
- name: Upload integration test results
340340
if: always() && github.event_name != 'pull_request' && matrix.integration-tests
341-
uses: actions/upload-artifact@v7
341+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
342342
with:
343343
name: dotnet-test-results-${{ matrix.targetFramework }}-${{ matrix.os }}
344344
path: IntegrationTestResults/**/*.junit
@@ -356,7 +356,7 @@ jobs:
356356
env:
357357
configuration: Release
358358
steps:
359-
- uses: actions/checkout@v6
359+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
360360
with:
361361
persist-credentials: false
362362
sparse-checkout: |
@@ -366,7 +366,7 @@ jobs:
366366
python
367367
368368
- name: Setup dotnet
369-
uses: actions/setup-dotnet@v5.2.0
369+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
370370
with:
371371
global-json-file: ${{ github.workspace }}/dotnet/global.json
372372

@@ -381,7 +381,7 @@ jobs:
381381
run: dotnet build dotnet/tests/Foundry.Hosting.IntegrationTests/Foundry.Hosting.IntegrationTests.csproj -c "$configuration" --warnaserror
382382

383383
- name: Azure CLI Login
384-
uses: azure/login@v2
384+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
385385
with:
386386
client-id: ${{ secrets.AZURE_CLIENT_ID }}
387387
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -442,7 +442,7 @@ jobs:
442442
runs-on: ubuntu-latest
443443
environment: integration
444444
steps:
445-
- uses: actions/checkout@v6
445+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
446446
with:
447447
persist-credentials: false
448448
sparse-checkout: |
@@ -453,7 +453,7 @@ jobs:
453453
declarative-agents
454454
455455
- name: Setup dotnet
456-
uses: actions/setup-dotnet@v5.2.0
456+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
457457
with:
458458
global-json-file: ${{ github.workspace }}/dotnet/global.json
459459

@@ -465,7 +465,7 @@ jobs:
465465
dotnet build ./tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests -c Release -f net10.0 --warnaserror
466466
467467
- name: Azure CLI Login
468-
uses: azure/login@v2
468+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
469469
with:
470470
client-id: ${{ secrets.AZURE_CLIENT_ID }}
471471
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -522,7 +522,7 @@ jobs:
522522

523523
- name: Upload functions test results
524524
if: always()
525-
uses: actions/upload-artifact@v7
525+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
526526
with:
527527
name: dotnet-test-results-functions-net10.0-ubuntu-latest
528528
path: IntegrationTestResults/**/*.junit
@@ -560,14 +560,14 @@ jobs:
560560
- name: Fail workflow if tests failed
561561
id: check_tests_failed
562562
if: contains(join(needs.*.result, ','), 'failure')
563-
uses: actions/github-script@v8
563+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
564564
with:
565565
script: core.setFailed('Integration Tests Failed!')
566566

567567
- name: Fail workflow if tests cancelled
568568
id: check_tests_cancelled
569569
if: contains(join(needs.*.result, ','), 'cancelled')
570-
uses: actions/github-script@v8
570+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
571571
with:
572572
script: core.setFailed('Integration Tests Cancelled!')
573573

@@ -585,7 +585,7 @@ jobs:
585585
run:
586586
working-directory: python
587587
steps:
588-
- uses: actions/checkout@v6
588+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
589589
with:
590590
persist-credentials: false
591591
sparse-checkout: |
@@ -597,12 +597,12 @@ jobs:
597597
python-version: "3.13"
598598
os: ${{ runner.os }}
599599
- name: Download all test results from current run
600-
uses: actions/download-artifact@v4
600+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
601601
with:
602602
pattern: dotnet-test-results-*
603603
path: dotnet-test-results/
604604
- name: Restore report history cache
605-
uses: actions/cache/restore@v4
605+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
606606
with:
607607
path: python/dotnet-integration-report-history.json
608608
key: dotnet-integration-report-history-${{ github.run_id }}
@@ -619,13 +619,13 @@ jobs:
619619
run: cat dotnet-integration-test-report.md >> $GITHUB_STEP_SUMMARY
620620
- name: Save report history cache
621621
if: always()
622-
uses: actions/cache/save@v4
622+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
623623
with:
624624
path: python/dotnet-integration-report-history.json
625625
key: dotnet-integration-report-history-${{ github.run_id }}
626626
- name: Upload trend report
627627
if: always()
628-
uses: actions/upload-artifact@v7
628+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
629629
with:
630630
name: dotnet-integration-test-report
631631
path: |

.github/workflows/dotnet-format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Check out code
33-
uses: actions/checkout@v6
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3434
with:
3535
fetch-depth: 0
3636
persist-credentials: false
@@ -42,7 +42,7 @@ jobs:
4242
- name: Get changed files
4343
id: changed-files
4444
if: github.event_name == 'pull_request'
45-
uses: jitterbit/get-changed-files@v1
45+
uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42 # v1
4646
continue-on-error: true
4747

4848
- name: No C# files changed

.github/workflows/dotnet-integration-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
environment: integration
3030
timeout-minutes: 60
3131
steps:
32-
- uses: actions/checkout@v6
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3333
with:
3434
ref: ${{ inputs.checkout-ref }}
3535
persist-credentials: false
@@ -50,7 +50,7 @@ jobs:
5050
echo "COSMOS_EMULATOR_AVAILABLE=true" >> $env:GITHUB_ENV
5151
5252
- name: Setup dotnet
53-
uses: actions/setup-dotnet@v5.2.0
53+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
5454
with:
5555
global-json-file: ${{ github.workspace }}/dotnet/global.json
5656

@@ -63,7 +63,7 @@ jobs:
6363
done
6464
6565
- name: Azure CLI Login
66-
uses: azure/login@v2
66+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
6767
with:
6868
client-id: ${{ secrets.AZURE_CLIENT_ID }}
6969
tenant-id: ${{ secrets.AZURE_TENANT_ID }}

0 commit comments

Comments
 (0)