Skip to content

Commit 217ce01

Browse files
brettlangdonxopham
andauthored
ci: pin all GitHub Actions by SHA and update via dependabot (#12189) [backport 2.21] (#12759)
backport of #12189 to `2.21` Changes with this PR are: - **Add dependabot for github actions** - **Pin all actions by hash** Pinning 3rd-party GitHub Actions by commit SHA makes them less vulnerable to compromise of the 3rd party. To avoid outdating and non-verbosity, versions are commented after the SHA and updating via dependabot is introduced that will automatically update the commented version tag as well. In case of a false commit SHA, this change could break the corresponding workflow. Typically, this does not cause major interruptions, but it can for example affect a release pipeline and require restart causing delays. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Christoph Hamsen <[email protected]>
1 parent e33ac7c commit 217ce01

28 files changed

+150
-135
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"
12+
groups:
13+
gh-actions-packages:
14+
patterns:
15+
- "*"

.github/workflows/backport.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
)
2525
)
2626
steps:
27-
- uses: tibdex/backport@v2
27+
- uses: tibdex/backport@9565281eda0731b1d20c4025c43339fb0a23812e # v2.0.4
2828
with:
2929
github_token: ${{ secrets.GITHUB_TOKEN }}
3030
body_template: "Backport <%= mergeCommitSha %> from #<%= number %> to <%= base %>.\n\n<%= body %>"

.github/workflows/build-and-publish-image.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ jobs:
2727
build_push:
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3131
with:
3232
persist-credentials: false
3333
- name: Set up QEMU
34-
uses: docker/setup-qemu-action@v2
34+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
3535
- name: Set up Docker Buildx
3636
id: buildx
37-
uses: docker/setup-buildx-action@v2
37+
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
3838
with:
3939
# Images after this version (>=v0.10) are incompatible with gcr and aws.
4040
version: v0.9.1 # https://github.com/docker/buildx/issues/1533
4141
- name: Login to Docker
4242
run: docker login -u publisher -p ${{ secrets.token }} ghcr.io
4343
- name: Docker Build
44-
uses: docker/build-push-action@v4
44+
uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1
4545
with:
4646
push: true
4747
tags: ${{ inputs.tags }}

.github/workflows/build_deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ jobs:
3131
name: Build source distribution
3232
runs-on: ubuntu-latest
3333
steps:
34-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3535
# Include all history and tags
3636
with:
3737
persist-credentials: false
3838
fetch-depth: 0
39-
- uses: actions-rust-lang/setup-rust-toolchain@v1
40-
- uses: actions/setup-python@v5
39+
- uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
40+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
4141
name: Install Python
4242
with:
4343
python-version: '3.12'
4444
- name: Build sdist
4545
run: |
4646
pip install "setuptools_scm[toml]>=4" "cython" "cmake>=3.24.2,<3.28" "setuptools-rust"
4747
python setup.py sdist
48-
- uses: actions/upload-artifact@v4
48+
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
4949
with:
5050
name: source-dist
5151
path: dist/*.tar.gz
@@ -58,10 +58,10 @@ jobs:
5858
container:
5959
image: python:3.9-alpine
6060
steps:
61-
- uses: actions/checkout@v4
61+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6262
with:
6363
persist-credentials: false
64-
- uses: actions/download-artifact@v4
64+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
6565
with:
6666
name: source-dist
6767
path: dist

.github/workflows/build_python_3.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
outputs:
2020
include: ${{steps.set-matrix.outputs.include}}
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323
with:
2424
persist-credentials: false
25-
- uses: actions/setup-python@v5
25+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
2626
with:
2727
python-version: '3.8'
2828
- run: pip install cibuildwheel==2.22.0
@@ -50,13 +50,13 @@ jobs:
5050
include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }}
5151

5252
steps:
53-
- uses: actions/checkout@v4
53+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5454
# Include all history and tags
5555
with:
5656
persist-credentials: false
5757
fetch-depth: 0
5858

59-
- uses: actions/setup-python@v5
59+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
6060
if: matrix.os != 'arm-4core-linux'
6161
name: Install Python
6262
with:
@@ -77,7 +77,7 @@ jobs:
7777
7878
- name: Set up QEMU
7979
if: runner.os == 'Linux' && matrix.os != 'arm-4core-linux'
80-
uses: docker/setup-qemu-action@v2
80+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
8181
with:
8282
platforms: all
8383

@@ -117,7 +117,7 @@ jobs:
117117

118118
- name: Build wheels
119119
if: always() && matrix.os != 'arm-4core-linux'
120-
uses: pypa/[email protected]
120+
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
121121
with:
122122
only: ${{ matrix.only }}
123123
env:
@@ -163,7 +163,7 @@ jobs:
163163
run: |
164164
chcp 65001 #set code page to utf-8
165165
echo "ARTIFACT_NAME=${{ matrix.only }}" >> $env:GITHUB_ENV
166-
- uses: actions/upload-artifact@v4
166+
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
167167
with:
168168
name: wheels-${{ env.ARTIFACT_NAME }}
169169
path: ./wheelhouse/*.whl

.github/workflows/changelog.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: Validate changelog
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1616
# Include all history and tags
1717
with:
1818
persist-credentials: false
@@ -26,7 +26,7 @@ jobs:
2626
if: github.event_name == 'pull_request'
2727
run: scripts/check-releasenotes
2828

29-
- uses: actions/setup-python@v5
29+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
3030
name: Install Python
3131
with:
3232
python-version: '3.8'
@@ -43,7 +43,7 @@ jobs:
4343
rst2html.py CHANGELOG.rst CHANGELOG.html
4444
4545
- name: Upload CHANGELOG.rst
46-
uses: actions/upload-artifact@v4
46+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
4747
with:
4848
name: changelog
4949
path: |

.github/workflows/check_old_target_branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
2727
- name: Old branch warning on PR
2828
if: env.old_branch == 'true'
29-
uses: thollander/actions-comment-pull-request@v2
29+
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
3030
with:
3131
message: |
3232
🚫 **This target branch is too old or unsupported. Please update the target branch to continue.**

.github/workflows/codeowners.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
permissions:
1111
pull-requests: write
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
with:
1515
persist-credentials: false
1616
fetch-depth: 0
1717
- name: Get changed files
1818
id: changed-files
19-
uses: tj-actions/changed-files@v44
19+
uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44.5.7
2020
- name: Setup go
21-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
2222
- name: Install codeowners
2323
run: go install github.com/hmarr/codeowners/cmd/codeowners@latest
2424
- name: List owners of all changed files
@@ -29,7 +29,7 @@ jobs:
2929
echo "$(codeowners ${{ steps.changed-files.outputs.all_changed_files }})" >> "$GITHUB_OUTPUT"
3030
echo "EOF" >> "$GITHUB_OUTPUT"
3131
- name: Comment PR
32-
uses: thollander/actions-comment-pull-request@v2
32+
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
3333
with:
3434
filePath: resolved.txt
3535
comment_tag: codeowners_resolved

.github/workflows/codeql-analysis.yml

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

2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030
with:
3131
persist-credentials: false
3232

3333
# Initializes the CodeQL tools for scanning.
3434
- name: Initialize CodeQL
35-
uses: github/codeql-action/init@v2
35+
uses: github/codeql-action/init@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2.28.1
3636
with:
3737
languages: ${{ matrix.language }}
3838
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -42,7 +42,7 @@ jobs:
4242
config-file: .github/codeql-config.yml
4343

4444
- name: Autobuild
45-
uses: github/codeql-action/autobuild@v2
45+
uses: github/codeql-action/autobuild@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2.28.1
4646

4747
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@v2
48+
uses: github/codeql-action/analyze@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2.28.1

.github/workflows/django-overhead-profile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
run:
3232
working-directory: ddtrace
3333
steps:
34-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3535
with:
3636
persist-credentials: false
3737
path: ddtrace
3838

39-
- uses: actions/setup-python@v5
39+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
4040
with:
4141
python-version: "3.10"
4242

@@ -48,7 +48,7 @@ jobs:
4848
run: |
4949
bash scripts/profiles/django-simple/run.sh ${PREFIX}
5050
51-
- uses: actions/upload-artifact@v4
51+
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
5252
with:
5353
name: django-overhead-profile${{ matrix.suffix }}
5454
path: ${{ github.workspace }}/prefix/artifacts

0 commit comments

Comments
 (0)