Add reusable relock workflow for Dependabot PRs by nodeselector · Pull Request #63 · github/gh-actions-lock · GitHub
Skip to content

Add reusable relock workflow for Dependabot PRs - #63

Merged
nodeselector merged 24 commits into
mainfrom
nodeselector-dependabot-relock-workflow
Jun 25, 2026
Merged

nodeselector merged 24 commits into
mainfrom
nodeselector-dependabot-relock-workflow

Conversation

@nodeselector

Copy link
Copy Markdown
Collaborator

When Dependabot bumps an action version in a workflow file, the actions.lock lockfile goes stale. This adds a reusable workflow that automatically re-pins the lockfile and commits it back to the PR branch.

How it works

relock.yml is a workflow_call target that:

  1. Checks out the PR head branch (not the merge ref, so we can push back)
  2. Installs gh-actions-lock from this repo's releases
  3. Runs gh actions-lock --no-onboard --no-interactive to re-pin changed deps
  4. Commits and pushes the updated actions.lock if anything changed

It accepts an optional extra-flags input for things like --allow-runners.

dependabot-relock.yml is a thin caller that triggers on pull_request, gates on dependabot[bot], and delegates to the reusable workflow. This repo dogfoods it.

Permissions

The workflow declares permissions: contents: write, which elevates the GITHUB_TOKEN for Dependabot-triggered runs (Dependabot PRs get read-only by default). No separate PAT or Dependabot secret needed -- GITHUB_TOKEN is auto-set in the runner env and gh reads it natively.

Consumer usage

name: Relock on Dependabot
on: pull_request

jobs:
  relock:
    if: github.event.pull_request.user.login == 'dependabot[bot]'
    uses: github/gh-actions-lock/.github/workflows/relock.yml@main

Adds two workflows:

- relock.yml: reusable workflow_call that installs gh-actions-lock,
  re-pins the lockfile with --no-onboard --no-interactive, and commits
  the updated actions.lock back to the PR branch.

- dependabot-relock.yml: thin caller that triggers on pull_request
  from dependabot[bot] and delegates to relock.yml.
Copilot AI review requested due to automatic review settings June 24, 2026 18:11
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:11
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:12
Comment thread .github/workflows/dependabot-relock.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Not ready to approve

The workflows as written will not reliably run and push updates back to the PR branch due to invalid runner selection and missing/incorrect ref + permissions wiring for workflow_call.

Pull request overview

Adds automation to keep .github/workflows/actions.lock up to date when Dependabot updates action versions in workflow files, by introducing a reusable relock workflow plus a Dependabot-only caller workflow for dogfooding in this repo.

Changes:

  • Introduces a reusable workflow_call workflow that runs gh actions-lock and commits/pushes actions.lock back to the PR branch.
  • Adds a pull_request-triggered workflow that runs only for dependabot[bot] PRs and delegates to the reusable workflow.
File summaries
File Description
.github/workflows/relock.yml New reusable workflow to relock actions.lock and push updates back to the PR branch.
.github/workflows/dependabot-relock.yml New Dependabot-only caller workflow that invokes the reusable relock workflow.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 4

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/dependabot-relock.yml
Comment thread .github/workflows/relock.yml
Comment thread .github/workflows/relock.yml
Comment thread .github/workflows/dependabot-relock.yml
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:19
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:20
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:20
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:20
Read-only check (--no-fix) that fails if actions.lock is out of sync
with the workflow files. Runs on ubuntu-slim.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:23
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:23
The repo is internal so gh extension install fails from the runner's
GITHUB_TOKEN. Build from source like the other jobs do.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:26
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:27
ubuntu-slim (Hosted Compute Docker image) doesn't expose GITHUB_TOKEN
in a way that gh extension install picks up. Set GH_TOKEN explicitly.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:36
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:37
The CLI needs a token to resolve action refs via the GitHub API.
ubuntu-slim doesn't expose GITHUB_TOKEN in a way the go-gh library
picks up automatically.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 18:51
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 18:51
Adds relock.yml to tracked workflows and upgrades lockfile schema
from v0.0.1 to v0.0.2.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 19:18
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 19:19
Reverts the premature lockfile update so the lint job can demonstrate
failure output. Reworks lockfile-lint to produce:
- Annotated error lines per finding (::error file=...)
- Grouped workflow status summary
- Lockfile diff showing what a fix would change
- Job summary with findings table
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 22:08
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:18
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:18
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:18
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:19
Consumers use github/gh-actions-lock/actions/lint@main after merge.
For CI in this repo, ./actions/lint resolves correctly.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:28
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:30
Replaces hardcoded local-action exemption with a configurable
ignore-categories input. Categories in the list become warnings
instead of blocking errors. No special cases in the script.
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:38
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:40
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:43
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:44
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:44
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:45
GitHub Actions fails to parse the workflow when a composite action
references itself. ./actions/lint is the correct pattern for
self-testing.
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:46
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:46
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:46
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:46
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:48
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:48
GitHub Advanced Security started work on behalf of nodeselector June 24, 2026 23:51
GitHub Advanced Security finished work on behalf of nodeselector June 24, 2026 23:53
@nodeselector
nodeselector merged commit 419a59e into main Jun 25, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants