Skip to content

Commit d064f2c

Browse files
authored
Sync Dependabot action pin comments via reusable workflow (#189)
* ci: sync Dependabot action pin comments via reusable workflow Thin caller for basecamp/.github's dependabot-sync-actions-comments reusable workflow (basecamp/.github#8): after CI completes on a Dependabot github_actions branch, trusted default-branch code fixes any stale pin version comments and pushes back behind a compare-and-swap lease, using the write deploy key scoped to this repo's dependabot-sync environment (deployment branches: default branch only). Also adds workflow_dispatch to test.yml and security.yml so the reusable workflow's CI-dispatch fallback can re-run checks on the pushed head. * chore(actions): sync action pin comments One-time catch-up applying what the new sync workflow will maintain automatically: version comments on SHA-pinned uses lines whose trailing zizmor annotations prevented Dependabot from rewriting them. * ci: filter workflow_run to dependabot branches at the trigger Review feedback: the job-level if only skips the job after the run is created; a trigger-level branches filter stops runs from being created for non-Dependabot branches at all. The if stays as defense-in-depth.
1 parent b4ff536 commit d064f2c

4 files changed

Lines changed: 52 additions & 1 deletion

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Sync Dependabot action pin comments
2+
3+
# Thin caller: all logic lives in basecamp/.github's reusable workflow —
4+
# trusted default-branch code that fetches the Dependabot head branch as data
5+
# only, rewrites stale `# vX.Y.Z` pin comments, and pushes back behind a
6+
# compare-and-swap lease using the write deploy key scoped to this repo's
7+
# dependabot-sync environment.
8+
9+
on:
10+
workflow_run: # zizmor: ignore[dangerous-triggers] -- only the SHA-pinned reusable workflow (reviewed default-branch code) executes; the Dependabot head branch is fetched as data, never executed
11+
workflows: [CI]
12+
types: [completed]
13+
branches: ["dependabot/github_actions/**"]
14+
workflow_dispatch:
15+
inputs:
16+
branch:
17+
description: Dependabot branch to sync (dependabot/github_actions/...)
18+
required: true
19+
type: string
20+
e2e:
21+
description: "E2E proof mode: expect a draft PR authored by the dispatcher on a dependabot/github_actions/e2e-proof-* branch"
22+
required: false
23+
default: false
24+
type: boolean
25+
26+
permissions: {}
27+
28+
jobs:
29+
sync:
30+
# Defense-in-depth behind the trigger-level branches filter (which stops
31+
# runs from being created for other branches at all); the reusable
32+
# workflow re-checks this and everything else.
33+
if: >-
34+
github.event_name == 'workflow_dispatch' ||
35+
startsWith(github.event.workflow_run.head_branch, 'dependabot/github_actions/')
36+
uses: basecamp/.github/.github/workflows/dependabot-sync-actions-comments.yml@95a9f7a2bd69c73cd2839eb4a27616e1651497e2
37+
with:
38+
ci-workflow-name: CI
39+
default-branch: master
40+
branch: ${{ inputs.branch || '' }}
41+
e2e: ${{ inputs.e2e || false }}
42+
permissions:
43+
contents: read
44+
actions: write
45+
pull-requests: read
46+
# The deploy key is scoped to this repo's dependabot-sync environment
47+
# (deployment branches: default branch only); environment secrets cannot
48+
# be forwarded explicitly to a reusable workflow, so inherit is required.
49+
secrets: inherit # zizmor: ignore[secrets-inherit] -- see above; the called workflow is SHA-pinned and reads only SYNC_ACTIONS_DEPLOY_KEY, gated by the dependabot-sync environment

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
persist-credentials: false
4242

4343
- name: Set up Go
44-
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v6.4.0 # zizmor: ignore[cache-poisoning] -- cache is branch-isolated; fork PRs cannot write to this cache
44+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 # zizmor: ignore[cache-poisoning] -- cache is branch-isolated; fork PRs cannot write to this cache
4545
with:
4646
go-version-file: go.mod
4747

‎.github/workflows/security.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Security
22

33
on:
4+
workflow_dispatch:
45
workflow_call:
56
push:
67
branches: [master]

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: CI
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [master]
67
pull_request:

0 commit comments

Comments
 (0)