CI/CD and automation · Beginner · 16 min
Configure Dependabot version and security updates
By Padding · Updated 18 Nov 2026
GitHub Dependabot · check-jsonschema 0.39.0 · Ubuntu 26.04
You will turn on Dependabot alerts and security updates for a repository and commit a validated dependabot.yml that updates npm, GitHub Actions and Docker weekly, in groups, with a held-back major version, a cooldown, pull request limits and a private registry token kept in Dependabot's own secrets.
On this page
Dependabot is the dependency bot built into GitHub. It does two separate jobs, and it helps to keep them apart in your head:
- Security updates react to advisories. When GitHub raises a Dependabot alert for a vulnerable package in your repository, Dependabot opens a pull request that moves it to the nearest fixed version. You switch this on in the repository settings; no file is needed.
- Version updates keep everything current on a schedule, whether or not there is an advisory. These are driven by a file you commit,
.github/dependabot.yml.
Left on its defaults, version updates can flood a busy repository with one pull request per package. In this tutorial you set up both jobs for a small Node.js service called shop-web that has npm packages, a GitHub Actions workflow and a Dockerfile, and you shape the version updates so they arrive as a few reviewable pull requests a week. You validate every version of the file before you push it, because Dependabot only reports a broken file after the fact.
Everything lives in ~/dependabot-demo on your computer. Wherever you see YOUR-ORG, replace it with your GitHub user or organisation name.
Step 1 · Create the example repository and the validator
Install Git and Python's virtual environment module, then install check-jsonschema 0.39.0 into its own environment. It carries a copy of the published schema for dependabot.yml, so it can tell you about a misspelt key or an out-of-range value without contacting GitHub.
sudo apt update
sudo apt install -y git python3-venv
mkdir -p ~/dependabot-demo
python3 -m venv ~/dependabot-demo/tools
~/dependabot-demo/tools/bin/pip install "check-jsonschema==0.39.0"
export PATH="$HOME/dependabot-demo/tools/bin:$PATH"On macOS, skip the two apt lines; python3 -m venv is already available. The export line only lasts for this terminal, so run it again if you open a new one.
Now create the project. It has one production dependency, two development dependencies, a CI workflow that uses two actions, and a Dockerfile with a base image: one of each of the three ecosystems Dependabot will look after.
mkdir -p ~/dependabot-demo/shop-web/.github/workflows
cd ~/dependabot-demo/shop-web
git init
cat > package.json <<'JSON'
{
"name": "shop-web",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"start": "node server.js",
"lint": "eslint .",
"format": "prettier --check ."
},
"dependencies": {
"express": "^5.1.0"
},
"devDependencies": {
"eslint": "^9.30.0",
"prettier": "^3.6.0"
}
}
JSON
cat > server.js <<'JS'
import express from 'express';
const app = express();
app.get('/', (req, res) => res.send('shop-web is running'));
app.listen(process.env.PORT || 3000);
JS
cat > eslint.config.js <<'JS'
export default [{ files: ['**/*.js'], languageOptions: { sourceType: 'module' } }];
JS
cat > Dockerfile <<'DOCKER'
FROM node:26-slim
WORKDIR /app
COPY package.json ./
RUN npm install --omit=dev
COPY server.js ./
CMD ["node", "server.js"]
DOCKER
cat > .github/workflows/ci.yml <<'YAML'
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: '26'
- run: npm install
- run: npm run lint
YAML
printf 'node_modules/\n' > .gitignore
git add .
git commit -m "Start shop-web"eslint.config.js is there because ESLint 9 stops with an error when it finds no flat config file, which would fail CI on every run. In a real project you would also commit package-lock.json. Dependabot updates the lock file alongside package.json when one is there.
Check it worked
check-jsonschema --version
cd ~/dependabot-demo/shop-web
git log --oneline
ls -AThe first line names version 0.39.0, git log shows one commit, and the listing shows .git, .github, .gitignore, Dockerfile, eslint.config.js, package.json and server.js.
Step 2 · Turn on alerts and security updates
Create an empty repository called shop-web under YOUR-ORG on GitHub, then push:
cd ~/dependabot-demo/shop-web
git remote add origin git@github.com:YOUR-ORG/shop-web.git
git push -u origin mainIn the repository on GitHub, open Settings. In the Security part of the sidebar, open Advanced Security (some accounts still label it Code security). Then:
- Make sure the Dependency graph is on. It is on by default for public repositories; private ones may need it turning on. Alerts are built from it.
- Next to Dependabot alerts, choose Enable.
- Next to Dependabot security updates, choose Enable.
If you prefer the command line, the GitHub CLI calls the same switches through the REST API:
gh api --method PUT repos/YOUR-ORG/shop-web/vulnerability-alerts
gh api --method PUT repos/YOUR-ORG/shop-web/automated-security-fixesLeave Grouped security updates alone for now. You will set grouping in dependabot.yml, and the file's group rules take precedence over that toggle. An organisation or enterprise policy can also lock these settings; if the buttons are greyed out, ask an organisation owner.
Check it worked
gh api repos/YOUR-ORG/shop-web/automated-security-fixesIt prints something like {"enabled":true,"paused":false}. In the browser, the repository's Security tab now lists Dependabot in its sidebar. With these packages there may be no alerts at all, which is fine: security updates only start work when an alert exists.
Step 3 · Write a first dependabot.yml for three ecosystems
Version updates need one entry under updates for each package manager and folder. Start with the smallest useful file: npm, GitHub Actions and Docker, each checked weekly on Monday morning in your own time zone.
cd ~/dependabot-demo/shop-web
cat > .github/dependabot.yml <<'YAML'
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
YAMLWhat each part does:
version: 2is the only syntax version; leave it as is.package-ecosystemnames the package manager.npmreadspackage.json(and covers Yarn and pnpm lock files as well),github-actionsreads theuses:lines in your workflows, anddockerreadsFROMlines in Dockerfiles.directoryis where the manifest lives, relative to the repository root. For GitHub Actions it is always/; Dependabot finds.github/workflowsfrom there. A monorepo can usedirectories:with a list or a glob such as/services/*instead.schedulesets how often Dependabot checks.timeis read as UTC unless you settimezone, which takes an IANA name. ReplaceAfrica/Lagoswith yours, for exampleAfrica/NairobiorEurope/London. Leavetimeout and GitHub picks a random time for you.
A Monday morning run means the week's update pull requests are waiting when the team starts, rather than arriving one by one through the weekend.
Check it worked
cd ~/dependabot-demo/shop-web
check-jsonschema --builtin-schema vendor.dependabot .github/dependabot.yml | tee check.txt
grep -q 'ok -- validation done' check.txt
rm check.txtIt prints ok -- validation done. Try changing interval: weekly to interval: weekley and run the check again: it fails with an error that names something like $.updates[0].schedule.interval. Change it back before you continue.
Step 4 · Group related updates
Without groups, a week with eight new package versions means eight pull requests and eight CI runs. Groups combine matching updates into one pull request each. Replace the file with this version:
cd ~/dependabot-demo/shop-web
cat > .github/dependabot.yml <<'YAML'
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
groups:
# Tooling that never ships to users: minor and patch bumps in one PR.
npm-dev:
dependency-type: development
update-types: [minor, patch]
# Runtime packages: minor and patch bumps in a second PR.
npm-prod:
dependency-type: production
update-types: [minor, patch]
# Security fixes for npm arrive together instead of one PR per advisory.
npm-security:
applies-to: security-updates
patterns: ['*']
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
groups:
actions:
patterns: ['*']
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
YAMLHow the groups divide the work:
npm-devandnpm-prodsplit bydependency-type, so a pull request that only touches build tools is clearly separate from one that changes what runs in production. Both list onlyminorandpatch, which means major updates are left out of every group and still arrive as single pull requests. That is deliberate: a major version can break things and deserves its own review.npm-securityusesapplies-to: security-updates. Groups apply to version updates unless you say otherwise, so without this line security fixes would still come one per package.actionsputs every action bump into one pull request. Action updates rarely conflict with each other, and the CI run on that pull request tests them all together.- Docker has a single base image here, so a group would add nothing.
Group names appear in pull request titles and branch names. Start and end each one with a letter, and use only letters, hyphens and underscores in between. You can also select packages by name with patterns and exclude-patterns, for example patterns: ['@types/*'] to bundle type definitions.
Check it worked
cd ~/dependabot-demo/shop-web
check-jsonschema --builtin-schema vendor.dependabot .github/dependabot.yml | tee check.txt
grep -q 'ok -- validation done' check.txt
rm check.txtIt prints ok -- validation done. Read the npm block once more and answer for yourself: where would an update from prettier 3.6 to 3.7 go, and where would express 5 to 6 go? (The first lands in npm-dev; the second is a pull request of its own.)
Step 5 · Hold back a major version, add a cooldown and limit open pull requests
Three more controls make the flow calmer:
ignorestops Dependabot proposing something you have decided against for now. Here the team is not ready for the next major version of Express, so major Express updates are ignored while minor and patch updates still come through.cooldownmakes Dependabot wait a number of days after a release before proposing it. Brand-new releases are the ones most likely to be pulled, patched again within days, or, occasionally, compromised. The wait applies to version updates only; security updates are never delayed.open-pull-requests-limitcaps how many version update pull requests can be open at once for that ecosystem. The default is 5. Security update pull requests have their own fixed limit of 10 and are not affected by this setting.
Replace the file again:
cd ~/dependabot-demo/shop-web
cat > .github/dependabot.yml <<'YAML'
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
open-pull-requests-limit: 4
cooldown:
default-days: 5
semver-major-days: 30
semver-minor-days: 7
semver-patch-days: 3
ignore:
# Express 6 needs a planned migration. Review this rule each quarter.
- dependency-name: express
update-types: ['version-update:semver-major']
groups:
npm-dev:
dependency-type: development
update-types: [minor, patch]
npm-prod:
dependency-type: production
update-types: [minor, patch]
npm-security:
applies-to: security-updates
patterns: ['*']
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
open-pull-requests-limit: 2
cooldown:
default-days: 7
groups:
actions:
patterns: ['*']
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
open-pull-requests-limit: 2
cooldown:
default-days: 7
YAMLPoints worth knowing:
- The comment on the
ignorerule matters. An ignore without a reason tends to outlive everyone who remembers why it was added. Put the reason and a review date next to it. - Ignore rules are broader than they look. GitHub marks
ignoreas an option that also shapes security updates, so a wide rule can hide a fix you need. Keep rules narrow: one package, one update type. - Per-level cooldowns only work where versions follow SemVer. npm supports
semver-major-daysand friends. Docker tags and GitHub Actions do not, so those two blocks use onlydefault-days. - Setting
open-pull-requests-limit: 0pauses version updates for that ecosystem without deleting its block, which is handy during a release freeze.
On a prepaid or metered connection, these limits help beyond GitHub too: fewer, larger pull requests mean fewer branches to fetch and fewer npm install runs when you check an update locally.
Check it worked
cd ~/dependabot-demo/shop-web
check-jsonschema --builtin-schema vendor.dependabot .github/dependabot.yml | tee check.txt
grep -q 'ok -- validation done' check.txt
rm check.txtIt prints ok -- validation done. The schema also enforces ranges: cooldown days run from 1 to 90 (patch cooldown may be 0). See it catch an over-long cooldown in a scratch copy:
cd ~/dependabot-demo/shop-web
sed 's/semver-major-days: 30/semver-major-days: 120/' .github/dependabot.yml > /tmp/dependabot-bad.yml
if check-jsonschema --builtin-schema vendor.dependabot /tmp/dependabot-bad.yml > bad.txt 2>&1; then
echo "expected a validation error"; false
fi
cat bad.txt
grep -q 'semver-major-days' bad.txt
rm bad.txt /tmp/dependabot-bad.ymlThe output names semver-major-days and says that 120 is greater than the maximum of 90. Your real file is untouched.
Step 6 · Reach a private registry with a Dependabot secret
Suppose shop-web later depends on a private package published to GitHub Packages, such as @your-org/ui. Dependabot needs a token to read that registry, and it does not read your Actions secrets. It has its own store: Settings, then Secrets and variables, then Dependabot.
Create a fine-grained or classic personal access token that can read packages from that registry, then save it as a Dependabot secret. The command prompts for the value, so the token does not land in your shell history:
gh secret set NPM_READ_TOKEN --app dependabot --repo YOUR-ORG/shop-webThen declare the registry at the top level of dependabot.yml and point the npm block at it. Replace the file one last time:
cd ~/dependabot-demo/shop-web
cat > .github/dependabot.yml <<'YAML'
version: 2
registries:
github-npm:
type: npm-registry
url: https://npm.pkg.github.com
token: ${{secrets.NPM_READ_TOKEN}}
updates:
- package-ecosystem: npm
directory: /
registries:
- github-npm
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
open-pull-requests-limit: 4
cooldown:
default-days: 5
semver-major-days: 30
semver-minor-days: 7
semver-patch-days: 3
ignore:
# Express 6 needs a planned migration. Review this rule each quarter.
- dependency-name: express
update-types: ['version-update:semver-major']
groups:
npm-dev:
dependency-type: development
update-types: [minor, patch]
npm-prod:
dependency-type: production
update-types: [minor, patch]
npm-security:
applies-to: security-updates
patterns: ['*']
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
open-pull-requests-limit: 2
cooldown:
default-days: 7
groups:
actions:
patterns: ['*']
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: monday
time: '06:00'
timezone: Africa/Lagos
open-pull-requests-limit: 2
cooldown:
default-days: 7
YAMLThe file holds only a reference, ${{secrets.NPM_READ_TOKEN}}, never the token itself, so it is safe to commit. Secret names may contain letters, digits and underscores, cannot start with a digit or with GITHUB_, and are stored in upper case.
The separate store has a second effect that catches many teams out. When Dependabot opens a pull request, the CI workflows that run on it also get Dependabot secrets, not Actions secrets. If your CI needs NPM_READ_TOKEN to run npm install, add the secret in both places, or Dependabot's pull requests fail in CI while everyone else's pass.
Check it worked
cd ~/dependabot-demo/shop-web
check-jsonschema --builtin-schema vendor.dependabot .github/dependabot.yml | tee check.txt
grep -q 'ok -- validation done' check.txt
rm check.txt
grep -n 'secrets.NPM_READ_TOKEN' .github/dependabot.ymlValidation passes, and grep finds the reference on the token: line. On GitHub, Settings, Secrets and variables, Dependabot lists NPM_READ_TOKEN, and the Actions page beside it does not, unless you added it there too.
Step 7 · Commit, push and watch the first run
cd ~/dependabot-demo/shop-web
git add .github/dependabot.yml
git commit -m "Configure Dependabot version updates"
git log --onelinegit pushDependabot notices the new file on the default branch and runs a first check soon after, without waiting for Monday. Version updates and security updates both open pull requests against the default branch; if you set target-branch for version updates, security updates still go to the default branch and ignore that block's options.
Check it worked
Within a few minutes the repository's Pull requests tab shows Dependabot pull requests: a grouped one for the action bumps (if newer releases exist), grouped npm ones and possibly a Docker base image bump. To see what each run did, open Insights, then Dependency graph, then the Dependabot tab, and choose Recent update jobs next to a manifest. A job that failed to reach the private registry says so in its log.
Review each pull request as you would a colleague's: read the release notes Dependabot links, let CI run, and merge when it passes. A bot proposing an update is not proof the update is safe.
Step 8 · Decide whether Dependabot is enough, or Renovate fits better
Renovate is the main alternative. Both open update pull requests; they differ in where they run and how much you can tune.
Question Dependabot Renovate
-------------------------------- ---------------------------------- ----------------------------------
Where it runs Built into GitHub Mend-hosted app, or self-hosted
from npm or a container image
Platforms GitHub GitHub, GitLab, Bitbucket, Azure
DevOps, Gitea, Forgejo and others
Config file .github/dependabot.yml renovate.json (or package.json)
Security updates Native, driven by Dependabot alerts Reads vulnerability data; set up
in its config
Wait after a release cooldown minimumReleaseAge
Auto-merge Not in the file; use a workflow automerge option in the config
that runs gh pr merge --auto
Overview of pending updates Pull requests and job logs Dependency Dashboard issue
Licence GitHub service Open source, AGPL-3.0Pick one tool per repository: do not run Dependabot version updates and Renovate on the same repository at once, or both will open pull requests for the same bumps.
A rule of thumb: on GitHub, start with Dependabot. It needs no app to install and its security updates are tied directly to the alerts you already see. Move to Renovate when you need another Git platform, finer rules than groups and ignores give you, or one shared preset across many repositories.
Check it worked
Write one line at the top of .github/dependabot.yml as a comment, for example # Dependabot chosen: GitHub only, no auto-merge needed (reviewed 2026-11), then run the validator once more. It still prints ok -- validation done. Commit and push the change so it reaches GitHub:
git commit -am "Record why Dependabot was chosen"
git pushgit log --oneline shows the new commit at the top, and the next person to open the file on GitHub knows why it exists.
Next steps
- Compare the same setup in Renovate: /tutorials/keep-dependencies-up-to-date-with-renovate
- Make sure every Dependabot pull request is tested before you merge it: /tutorials/run-node-tests-in-github-actions
- Pin actions to commit hashes and tighten tokens, then let Dependabot keep the pins current: /tutorials/harden-github-actions-workflows
- New to workflows: /tutorials/github-actions-first-workflow
Related tutorials
- Run only the CI jobs a change needs with path filters and concurrencyYou will have GitHub Actions workflows that skip tests for documentation-only changes without blocking merges, cancel superseded pull request runs, queue deploys instead of cancelling them, and stop any job that runs too long.
- Run Python tests and linters in GitHub Actions with uvYou will have a GitHub Actions workflow that installs a Python project with uv from its lock file, fails on a stale uv.lock, runs Ruff and pytest with a coverage floor on two Python versions, caches uv's downloads and keeps the coverage report as an artifact.
- Publish an npm package from GitHub Actions with trusted publishing and provenanceYou will have a small npm package that GitHub Actions publishes on each version tag through npm trusted publishing, with no NPM_TOKEN secret and a provenance attestation on every release.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials