Skip to content

Commit e999151

Browse files
authored
Pin GitHub Action references to commit SHAs (#162)
1 parent 682b0cb commit e999151

File tree

9 files changed

+53
-28
lines changed

9 files changed

+53
-28
lines changed

.github/actions/test_gem/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ runs:
5858
# ...but not for appraisals, sadly.
5959
- name: Install Ruby ${{ inputs.ruby }} with dependencies
6060
if: "${{ steps.setup.outputs.appraisals == 'false' }}"
61-
uses: ruby/setup-ruby@v1.221.0
61+
uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 #v1.221.0
6262
with:
6363
ruby-version: "${{ inputs.ruby }}"
6464
working-directory: "${{ steps.setup.outputs.gem_dir }}"
@@ -69,7 +69,7 @@ runs:
6969
# If we're using appraisals, do it all manually.
7070
- name: Install Ruby ${{ inputs.ruby }} without dependencies
7171
if: "${{ steps.setup.outputs.appraisals == 'true' }}"
72-
uses: ruby/setup-ruby@v1.221.0
72+
uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 #v1.221.0
7373
with:
7474
ruby-version: "${{ inputs.ruby }}"
7575
bundler: "latest"

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
45+
uses: github/codeql-action/init@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 #v2.28.1
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
59+
uses: github/codeql-action/autobuild@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 #v2.28.1
6060

6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -69,6 +69,6 @@ jobs:
6969
# ./location_of_script_within_repo/buildscript.sh
7070

7171
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
72+
uses: github/codeql-action/analyze@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 #v2.28.1
7373
with:
7474
category: "/language:${{matrix.language}}"

.github/workflows/integration-testing.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ jobs:
1919
APP_PATH: sample-apps/${{ matrix.instrumentation-type}}-instrumentation/${{ matrix.app-platform }}
2020
steps:
2121
- name: Checkout This Repo
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0
2323
- name: Configure AWS Credentials
24-
uses: aws-actions/configure-aws-credentials@v1
24+
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 #v1.7.0
2525
with:
2626
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
2727
role-duration-seconds: 1200
2828
aws-region: us-east-1
2929
- name: Log in to the AWS ECR
30-
uses: docker/login-action@v2
30+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc #v2.2.0
3131
with:
3232
registry: public.ecr.aws
3333
- name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v2
34+
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 #v2.10.0
3535
- name: Cache Docker layers
36-
uses: actions/cache@v3
36+
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c #v3.5.0
3737
with:
3838
path: /tmp/.buildx-cache
3939
key: ${{ runner.os }}-buildx-${{ github.sha }}
@@ -44,7 +44,7 @@ jobs:
4444
echo "APP_IMAGE=public.ecr.aws/aws-otel-test/ruby-${{ matrix.app-platform }}-${{ matrix.instrumentation-type }}:${{ github.sha }}" |
4545
tee --append $GITHUB_ENV;
4646
- name: Build and Push Docker image
47-
uses: docker/build-push-action@v3
47+
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 #v3.3.1
4848
with:
4949
push: true
5050
context: ${{ env.APP_PATH }}

.github/workflows/pr-build-gems.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
name: "${{ matrix.gem }} / ${{ matrix.os }}"
2828
runs-on: ${{ matrix.os }}
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
3131
- name: "Test Ruby 3.4"
3232
uses: ./.github/actions/test_gem
3333
with:

.github/workflows/pr-build.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
APP_PATH: sample-apps/${{ matrix.instrumentation-type}}-instrumentation/${{ matrix.app-platform }}
1818
steps:
1919
- name: Checkout This Repo
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0
2121
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v2
22+
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 #v2.10.0
2323
- name: Cache Docker layers
24-
uses: actions/cache@v3
24+
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c #v3.5.0
2525
with:
2626
path: /tmp/.buildx-cache
2727
key: ${{ runner.os }}-buildx-${{ github.sha }}
@@ -32,10 +32,35 @@ jobs:
3232
echo "APP_IMAGE=public.ecr.aws/aws-otel-test/ruby-${{ matrix.app-platform }}-${{ matrix.instrumentation-type }}:${{ github.sha }}" |
3333
tee --append $GITHUB_ENV;
3434
- name: Build Docker image
35-
uses: docker/build-push-action@v3
35+
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 #v3.3.1
3636
with:
3737
context: ${{ env.APP_PATH }}
3838
tags: |
3939
${{ env.APP_IMAGE }}
4040
cache-from: type=local,src=/tmp/.buildx-cache
4141
cache-to: type=local,dest=/tmp/.buildx-cache
42+
43+
static-code-checks:
44+
runs-on: ubuntu-latest
45+
steps:
46+
47+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0
48+
with:
49+
fetch-depth: 0
50+
- name: Check for versioned GitHub actions
51+
if: always()
52+
run: |
53+
# Get changed GitHub workflow/action files
54+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E "^\.github/(workflows|actions)/.*\.ya?ml$" || true)
55+
56+
if [ -n "$CHANGED_FILES" ]; then
57+
# Check for any versioned actions, excluding comments and this validation script
58+
VIOLATIONS=$(grep -Hn "uses:.*@v" $CHANGED_FILES | grep -v "grep.*uses:.*@v" | grep -v "#.*@v" || true)
59+
if [ -n "$VIOLATIONS" ]; then
60+
echo "Found versioned GitHub actions. Use commit SHAs instead:"
61+
echo "$VIOLATIONS"
62+
exit 1
63+
fi
64+
fi
65+
66+
echo "No versioned actions found in changed files"

.github/workflows/release-udp-exporter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
needs: validate-udp-exporter-e2e-test
2727
steps:
2828
- name: Checkout Repo @ SHA - ${{ github.sha }}
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
3030

3131
# Install ruby and bundle dependencies and cache!
3232
- name: Install Ruby ${{ env.RUBY_VERSION }} with dependencies
33-
uses: ruby/setup-ruby@v1.221.0
33+
uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 #v1.221.0
3434
with:
3535
ruby-version: "${{ env.RUBY_VERSION }}"
3636
working-directory: "exporter/xray-udp"

.github/workflows/soak-testing.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
run: |
6969
echo "$TEST_DURATION_MINUTES" | tee --append $GITHUB_ENV;
7070
- name: Clone This Repo @ ${{ env.TARGET_SHA }}
71-
uses: actions/checkout@v3
71+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0
7272
with:
7373
ref: ${{ env.TARGET_SHA }}
7474

@@ -97,7 +97,7 @@ jobs:
9797
# MARK: - Run Performance Tests
9898

9999
- name: Configure AWS Credentials
100-
uses: aws-actions/configure-aws-credentials@v1
100+
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 #v1.7.0
101101
with:
102102
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
103103
role-duration-seconds: 21600 # 6 Hours
@@ -197,7 +197,7 @@ jobs:
197197
git checkout main;
198198
[[ $HAS_RESULTS_ALREADY == true ]]
199199
- name: Graph and Report Performance Test Averages result
200-
uses: benchmark-action/github-action-benchmark@v1
200+
uses: benchmark-action/github-action-benchmark@a7bc2366eda11037936ea57d811a43b3418d3073 #v1.21.0
201201
continue-on-error: true
202202
id: check-failure-after-performance-tests
203203
with:
@@ -217,7 +217,7 @@ jobs:
217217
gh-pages-branch: gh-pages
218218
benchmark-data-dir-path: soak-tests/per-commit-overall-results
219219
- name: Publish Issue if failed DURING Performance Tests
220-
uses: JasonEtco/create-an-issue@v2
220+
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 #v2.9.2
221221
if: ${{ github.event_name == 'schedule' &&
222222
steps.check-failure-during-performance-tests.outcome == 'failure' }}
223223
env:
@@ -228,7 +228,7 @@ jobs:
228228
filename: .github/auto-issue-templates/failure-during-soak_tests.md
229229
update_existing: true
230230
- name: Publish Issue if failed AFTER Performance Tests
231-
uses: JasonEtco/create-an-issue@v2
231+
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 #v2.9.2
232232
if: ${{ github.event_name == 'schedule' &&
233233
steps.check-failure-after-performance-tests.outcome == 'failure' }}
234234
env:

.github/workflows/stale-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Mark the issues/pr
29-
uses: actions/stale@v7
29+
uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b #v7.0.0
3030
env:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #Github workflow will add a temporary token when executing the workflow
3232
with:

.github/workflows/udp-exporter-e2e-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout Repo @ SHA - ${{ github.sha }}
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
2020

2121
# Install ruby and bundle dependencies and cache!
2222
- name: Install Ruby ${{ env.RUBY_VERSION }} with dependencies
23-
uses: ruby/setup-ruby@v1.221.0
23+
uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 #v1.221.0
2424
with:
2525
ruby-version: "${{ env.RUBY_VERSION }}"
2626
working-directory: "exporter/xray-udp"
@@ -29,7 +29,7 @@ jobs:
2929
cache-version: "v1-ruby-xray-udp"
3030

3131
- name: Configure AWS credentials for Testing Tracing
32-
uses: aws-actions/configure-aws-credentials@v4
32+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a #v4.3.1
3333
with:
3434
role-to-assume: ${{ secrets.XRAY_UDP_EXPORTER_TEST_ROLE }}
3535
aws-region: 'us-east-1'

0 commit comments

Comments
 (0)