pin third-party actions and scope workflow tokens (#25094)

easimon/maximize-build-space ran from a branch, and the lowercase and manifest actions ran from mutable tags, inside jobs that push images and mint build attestations. The release workflow also ran skopeo from its latest tag with the push credential mounted. The actions are now pinned to commit SHAs with version comments so Dependabot still bumps them, the lowercase action is replaced with ${GITHUB_REPOSITORY,,}, and skopeo is pinned by digest. ci.yml, release.yml, pull_request.yml and stale.yml now declare explicit token permissions instead of relying on the repository default.
This commit is contained in:
Josh Hawkins
2026-11-25 08:16:02 -07:00
committed by GitHub
parent b213d1e73c
commit 717f623b74
5 changed files with 34 additions and 16 deletions
+11 -4
View File
@@ -14,6 +14,9 @@ concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PYTHON_VERSION: 3.11
@@ -21,6 +24,9 @@ jobs:
amd64_build:
runs-on: ubuntu-22.04
name: AMD64 Build
permissions:
contents: read
packages: write
steps:
- name: Check out code
uses: actions/checkout@v7
@@ -45,6 +51,9 @@ jobs:
smoke_test:
runs-on: ubuntu-22.04
name: AMD64 Smoke Test
permissions:
contents: read
packages: read
needs:
- amd64_build
steps:
@@ -675,9 +684,7 @@ jobs:
- arm64_build
steps:
- id: lowercaseRepo
uses: ASzc/change-string-case-action@v8
with:
string: ${{ github.repository }}
run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Log in to the Container registry
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
with:
@@ -686,7 +693,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create short sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- uses: int128/docker-manifest-create-action@v2
- uses: int128/docker-manifest-create-action@d6ac360314337bbfb870747d9616b83118acb330 # v2.30.0
id: manifest
with:
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
+3
View File
@@ -8,6 +8,9 @@ on:
- ".github/DISCUSSION_TEMPLATE/**"
- ".github/ISSUE_TEMPLATE/**"
permissions:
contents: read
env:
DEFAULT_PYTHON: 3.11
+11 -7
View File
@@ -5,6 +5,10 @@ on:
release:
types: [published]
permissions:
contents: read
packages: write
jobs:
release:
runs-on: ubuntu-latest
@@ -14,9 +18,7 @@ jobs:
with:
persist-credentials: false
- id: lowercaseRepo
uses: ASzc/change-string-case-action@v8
with:
string: ${{ github.repository }}
run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Log in to the Container registry
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
with:
@@ -34,19 +36,21 @@ jobs:
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "CLEAN_VERSION=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's/^[v]//')" >> $GITHUB_ENV
- name: Tag and push the main image
env:
SKOPEO: quay.io/skopeo/stable:v1.24.1-immutable@sha256:81a8d4265c339539cba229459fdc4cb3580e1d2c2cb4285271c75adaa0fcb9b5
run: |
VERSION_TAG=${BASE}:${CLEAN_VERSION}
STABLE_TAG=${BASE}:stable
PULL_TAG=${BASE}:${BUILD_TAG}
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG}
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG}
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant}
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant}
done
# stable tag
if [[ "${BUILD_TYPE}" == "stable" ]]; then
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG}
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG}
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant}
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant}
done
fi
+6 -1
View File
@@ -7,11 +7,16 @@ on:
schedule:
- cron: "0 0 * * *" # run stalebot once a day
permissions:
actions: write
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@main
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
id: stale
with:
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."