Sub topic 6
Updating pinned actions with Dependabot
A SHA pin makes a workflow reproducible, but it also freezes the action at one commit. Nobody remembers to bump forty pins by hand, so bug fixes and security patches stop arriving. Dependabot closes that gap. It opens pull requests that move each pin to a newer release, and you review them like any other change.
This chapter assumes you can read a workflow file and know why uses: owner/repo@<full SHA> is safer than @v4. It also assumes you have used a dependency updater such as Dependabot for npm or pip.
What Dependabot does with action references
Dependabot has several jobs. This chapter covers version updates for the github-actions ecosystem. Dependabot scans your workflow files, finds every uses: reference to an action or reusable workflow, and compares each one with the latest release in the upstream repository. When it finds something newer, it opens a pull request.
Here is the minimal configuration. It goes in .github/dependabot.yml on the default branch.
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"With directory: "/", Dependabot looks in .github/workflows/. It also checks an action.yml or action.yaml at the repository root. The directory setting does not mean "the repository root only", which surprises many people.
How it handles SHA pins
For a pin like this one, Dependabot reads the trailing comment as the human-readable version.
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2When a newer release exists, the pull request changes both the SHA and the comment. The diff looks like this:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ - uses: actions/checkout@<new full SHA> # v4.3.0Treat the comment as part of the contract. If you pin to a SHA and delete the comment, Dependabot has less to go on when it decides which release you are on. Reviewers also lose the ability to see at a glance what changed. Keep a comment that contains only the version tag, such as # v4.2.2. Avoid free text there.
The pull request description carries the release notes and commit list from upstream. That is your first review material.
The update lifecycle
The diagram shows the path from an upstream release to a merged pin.
Two points matter here. First, CI runs on the pull request, so a broken action update fails visibly before it reaches the default branch. Second, a human still decides. Dependabot automates discovery, not trust.
Tuning the configuration
The minimal file works, but a real repository usually needs more. This version covers the common cases.
version: 2
updates:
- package-ecosystem: "github-actions"
directories:
- "/"
- "/.github/actions/*"
schedule:
interval: "weekly"
day: "monday"
cooldown:
default-days: 7
groups:
actions-minor-patch:
patterns:
- "*"
update-types:
- "minor"
- "patch"
open-pull-requests-limit: 5
labels:
- "dependencies"
- "ci"
commit-message:
prefix: "ci"Each setting does one thing:
directorieslists several locations, and globs are allowed. This is how you cover local composite actions under.github/actions/. A singledirectory: "/"does not look inside those folders, so any action they call stays un-updated.schedulesets how often Dependabot checks. Weekly is a sensible default. Daily produces noise for most teams.cooldowntells Dependabot to wait a number of days after a release before proposing it. A fresh release is the riskiest moment, because a compromised release is often detected within days. Waiting gives the community time to notice. Cooldown applies to version updates, not to security updates.groupsbundles several updates into one pull request. Grouping minor and patch updates cuts review overhead. Leave major updates ungrouped so each one gets its own look.open-pull-requests-limitcaps how many update pull requests can be open at once. The default is five for version updates.labelsandcommit-messagemake the pull requests easy to filter and keep your commit history consistent.
Skipping or holding back an action
Sometimes you must stay on an older major version, for example when v5 drops a runner you still use. Use ignore:
ignore:
- dependency-name: "actions/upload-artifact"
update-types: ["version-update:semver-major"]Write down why you ignored it, in a comment next to the entry. An ignore rule with no explanation tends to outlive its reason.
Reviewing a Dependabot pull request
Merging without looking defeats the point of pinning. A SHA pin protects you from an unnoticed change, and an auto-merged update brings that change back in. Check these things:
- Read the release notes in the pull request body. Look for changed inputs, changed defaults, removed features, and new permissions needs.
- Confirm the version comment matches the release you expect. A jump from v4.2.2 to v4.3.0 is normal. A jump to a version that does not appear in the project's releases page is a reason to stop.
- Open the compare view for the commit range, if the change touches something sensitive such as a deploy step. Pay attention to new network calls, new downloaded binaries, and changes to the entry script.
- Check CI. The pull request runs your workflows with the new version, which is the real compatibility test.
- Look at the repository's own health. A repository transferred to a new owner, or one with a sudden burst of unfamiliar maintainers, deserves extra scrutiny.
Auto-merge is possible for patch updates of trusted actions, using branch protection with required checks. If you enable it, limit it to a short allowlist and keep the cooldown on.
Practical limits and gotchas
Dependabot pull requests run with a restricted token. For a pull request opened by Dependabot, GITHUB_TOKEN is read-only by default and normal repository secrets are not available. Secrets for these runs must be added separately as Dependabot secrets. If a workflow needs a secret during CI, it will fail on Dependabot pull requests until you add it there. This is by design, because the update content comes from outside your repository.
Dependabot updates only what it can see. It does not rewrite the inner references of an action you depend on, and it does not touch references inside someone else's composite action or reusable workflow. It handles the uses: lines in your files. That gap is the subject of a later chapter.
Dependabot also does not enforce pinning. If someone adds uses: some/action@v1 in a new workflow, Dependabot will update that tag reference to a newer tag but will not convert it to a SHA. A policy that requires SHAs, covered in the next chapter, is what prevents that.
Dependabot needs a version to follow. For references to a branch, such as @main, there is no release to compare, so it has nothing meaningful to propose. Pin branch references to a SHA and a release tag first.
Security updates versus version updates
These are two separate features. Version updates follow your schedule and keep you current. Security updates open a pull request when a known advisory affects an action you use, and they do not wait for the schedule. Enable Dependabot alerts and security updates in the repository settings in addition to the file above. Without alerts on, you learn about a vulnerable action only when the next scheduled run happens to move past it.
Exercise
Your repository has workflows in .github/workflows/ and a local composite action in .github/actions/setup-tools/action.yml that calls actions/cache@<SHA> # v4.0.0. Your Dependabot file has only directory: "/". Which references will Dependabot update, and what change to the configuration covers the rest?
Show answer
With directory: "/", Dependabot scans .github/workflows/ and a root-level action.yml, so it updates the references in the workflow files. It does not look inside .github/actions/setup-tools/, so the actions/cache pin stays unchanged. Replace directory with directories and add a glob such as "/.github/actions/*" next to "/". Then Dependabot scans each local action folder as well.
Exercise
A teammate says: "We pin every action to a SHA, so we can turn Dependabot off and avoid the noise." Give two concrete problems with that plan and one setting that reduces the noise without turning updates off.
Show answer
First, pinned actions stop receiving bug fixes and security patches, so the workflow runs known-vulnerable or outdated code until someone updates the pins by hand. Second, with no automation the pins go stale and are updated rarely, which makes each eventual jump larger and harder to review. To cut noise, use groups to bundle minor and patch updates into one pull request, lengthen the schedule interval, or add a cooldown so only releases that have aged a few days are proposed.