From aa77681550eb545d8d2ca7f96520898fe6f42926 Mon Sep 17 00:00:00 2001 From: Takayuki Miyahara Date: Sat, 31 Oct 2026 13:30:31 +0900 Subject: [PATCH] ci: lock GitHub Actions dependencies and verify lockfile --- .github/ACTIONS_LOCKFILE.md | 33 ++++++++++++ .github/dependabot.yml | 9 ++++ .github/workflows/actions.lock | 50 +++++++++++++++++++ .github/workflows/verify-actions-lockfile.yml | 27 ++++++++++ 4 files changed, 119 insertions(+) create mode 100644 .github/ACTIONS_LOCKFILE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/actions.lock create mode 100644 .github/workflows/verify-actions-lockfile.yml diff --git a/.github/ACTIONS_LOCKFILE.md b/.github/ACTIONS_LOCKFILE.md new file mode 100644 index 0000000..9fc8a27 --- /dev/null +++ b/.github/ACTIONS_LOCKFILE.md @@ -0,0 +1,33 @@ +# GitHub Actions dependency lockfile + +Existing workflows and the lockfile verification workflow are covered by +`.github/workflows/actions.lock`. The lockfile records exact commits and +source repository identities, including transitive action dependencies. + +After adding a workflow or changing an action reference, regenerate with: + +```sh +gh extension install github/gh-actions-lock --pin v0.4.0 +gh actions-lock --no-narrow +gh actions-lock --verify +``` + +Review changed commits and repository identities before committing the +workflows and lockfile together. Existing action version references are kept +as written. GitHub Actions Dependabot updates run weekly as one group and +maintain lockfile entries for onboarded workflows. + +A moved branch or major tag does not automatically update the locked commit. +Review the upstream change, then use `gh actions-lock --relock --no-narrow`. +Do not use `--accept-moved` in automation or edit the lockfile by hand. + +This covers action code, not service/container images, runner images, +packages installed by scripts, or external reusable workflow calls. The latter +require explicit SHA pins and a lockfile in their source repository. +Local `./` actions use the checked-out workspace and are not locked. + +The verification job checks consistency and provenance with read-only +repository permissions. It does not prove the locked actions are safe and +does not execute application tests or deployment scripts. + +Docs: https://docs.github.com/en/actions/concepts/security/workflow-dependency-lockfiles diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..58838a2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: + github-actions: + patterns: ["*"] diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock new file mode 100644 index 0000000..121919c --- /dev/null +++ b/.github/workflows/actions.lock @@ -0,0 +1,50 @@ +# This file is machine-generated by `gh actions-lock`. +# Do not edit by hand; run `gh actions-lock` to update. +# Docs: https://gh.io/actions-lockfile +version: 'v0.0.3' +workflows: + '.github/workflows/publish-docker-image.yml': + - 'actions/checkout@v3' + - 'docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc' + - 'docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9' + - 'docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38' + - 'docker/setup-buildx-action@v1' + - 'docker/setup-qemu-action@v1' + '.github/workflows/verify-actions-lockfile.yml': + - 'actions/checkout@v7.0.1' +dependencies: + 'actions/checkout@v3': + ref: 'v3' + commit: 'sha1-a37ce9120846195fa4ece8f58b268e6043cb2f26' + owner_id: 44036562 + repo_id: 197814629 + 'actions/checkout@v7.0.1': + ref: 'v7.0.1' + commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1' + owner_id: 44036562 + repo_id: 197814629 + 'docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc': + ref: 'v2.5.0' + commit: 'sha1-ad44023a93711e3deb337508980b4b5e9bcdc5dc' + owner_id: 5429470 + repo_id: 241092383 + 'docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9': + ref: 'v1.10.0' + commit: 'sha1-f054a8b539a109f9f41c372932f1ae047eff08c9' + owner_id: 5429470 + repo_id: 287743349 + 'docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38': + ref: 'v3.3.0' + commit: 'sha1-98669ae865ea3cffbcbaa878cf57c20bbf1c6c38' + owner_id: 5429470 + repo_id: 306769011 + 'docker/setup-buildx-action@v1': + ref: 'v1' + commit: 'sha1-f211e3e9ded2d9377c8cadc4489a4e38014bc4c9' + owner_id: 5429470 + repo_id: 288485773 + 'docker/setup-qemu-action@v1': + ref: 'v1' + commit: 'sha1-27d0a4f181a40b142cce983c5393082c365d1480' + owner_id: 5429470 + repo_id: 288487894 diff --git a/.github/workflows/verify-actions-lockfile.yml b/.github/workflows/verify-actions-lockfile.yml new file mode 100644 index 0000000..0368231 --- /dev/null +++ b/.github/workflows/verify-actions-lockfile.yml @@ -0,0 +1,27 @@ +name: Verify Actions lockfile + +on: + pull_request: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Install pinned lockfile verifier + run: gh extension install github/gh-actions-lock --pin v0.4.0 + env: + GH_TOKEN: ${{ github.token }} + - name: Verify locked dependencies + run: gh actions-lock --verify + env: + GH_TOKEN: ${{ github.token }}