All jobs

Add Dependabot to a CMake C++ Project

Yes. An agent inventories what Dependabot can and cannot track in a CMake project, writes a grouped weekly config for its GitHub Actions, checks it and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent clones the repository into its own cloud sandbox and lists every dependency a bot could watch. In a header-only library like jarro2783/cxxopts there is no package manager manifest at all: CMakeLists.txt declares an INTERFACE target and gates examples, tests and install behind options, meson.build mirrors it, and the one third-party file is a vendored test/catch.hpp, a single-header test framework copied into the tree. What Dependabot can see is under .github/workflows/: build.yml and cmake.yml check out with actions/checkout@v4, meson.yml already uses actions/checkout@v6 with actions/setup-python@v5 and BSFishy/meson-build@v1.0.3, both cmake.yml and meson.yml use ilammy/msvc-dev-cmd@v1, and cifuzz.yml runs google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master and run_fuzzers@master with actions/upload-artifact@v4. There is no .github/dependabot.yml, no Renovate config and no git submodule.

It writes .github/dependabot.yml with version: 2 and one entry for the github-actions ecosystem at directory /, a weekly schedule on a fixed weekday, a groups block that bundles every action update into a single pull request so a quiet repository gets one bump a week rather than one per action, a ci commit-message prefix to match the repository's history, and a dependencies label. Because actions in cifuzz.yml are pinned to @master, which has no version to bump, the agent leaves them as they are and says so in the pull request rather than rewriting a fuzzing setup it did not change. It also notes the drift the inventory exposed, checkout@v4 in two workflows beside checkout@v6 in a third, which the first Dependabot pull request will resolve.

The vendored test/catch.hpp is listed as untracked: Dependabot has no ecosystem for a copied header, and the honest options are to leave it, to fetch Catch2 with FetchContent so a version appears in CMakeLists.txt that a future tool could read, or to add it as a git submodule, which Dependabot's gitsubmodule ecosystem does track. The agent recommends in the pull request but does not make that change, since it alters how the test suite builds.

It validates the file before opening anything: check-jsonschema --builtin-schema vendor.dependabot .github/dependabot.yml against the published schema and yamllint for the YAML itself, both run in the sandbox, with the output pasted into the description. It also runs the project's own build once, cmake -S . -B build and ctest in build/test, to confirm the pull request changes nothing about the code path, which it cannot since it adds one YAML file, but the record then shows a green build next to the config.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Add Dependabot to this CMake C++ project. Read CMakeLists.txt, any Meson or Bazel files, the test directory and every workflow under .github/workflows first, and list what Dependabot can track and what it cannot, including vendored headers and actions pinned to a branch. Write .github/dependabot.yml for the github-actions ecosystem with a weekly schedule, a single group for all action updates, a ci commit prefix and a dependencies label. Do not edit the workflows. Validate the file with check-jsonschema using the built-in Dependabot schema and with yamllint, run the CMake build and ctest once, and open a pull request whose description lists the tracked actions, the untracked items with the reason, and the version drift between workflows that the first Dependabot pull request will fix.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

What comes back is a pull request adding one file, .github/dependabot.yml, and changing nothing else. Its description is an inventory: the actions across the four workflows with their current versions, the two @master references and the vendored catch.hpp under a heading for what Dependabot will not touch and why, and the schema and lint output showing the file is valid.

The run's record keeps the validator output and the CMake build and test run, so a reviewer can trust that the YAML is well-formed and that the repository built cleanly at the commit the config was written against.

Before merging, a reviewer checks that Dependabot is allowed on the repository or organisation, picks the weekday that suits the maintainers, and decides whether to take the recommendation on catch.hpp as a follow-up issue so the test framework stops being invisible to every update tool.

Run it on every Dependabot pull request

Once the config is merged, the recurring work is reading what each bump changes. A github trigger never fires for a pull request a bot opens, so Dependabot's pull requests cannot start an automation in the console; a handler on your server starts one run per Dependabot pull request instead, with that pull request's branch checked out. For a Dependabot pull request the run reads the release notes of each bumped action between the old and new versions, checks the inputs the workflows pass against any that were renamed or removed, such as the artifact behaviour change between upload-artifact majors, and posts a review comment that says whether the workflows need an edit beyond the version bump.

The handler receives GitHub's pull_request webhook, checks that the author is Dependabot, and sends one POST /o/{org}/sessions per Dependabot pull request, naming the pull request URL in resources so the run checks out that branch, with a request_id that is a UUID v5 of the pull request id so a redelivery never starts a second run.

The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.

Why run it on Rush?

A Dependabot config for a C++ project is small, and the value is in the inventory around it: knowing that the test framework is a vendored header no bot will ever update, that two fuzzing actions follow a branch, and that three workflows disagree on a checkout version. The agent builds that inventory from the files rather than from memory, validates the config against GitHub's schema in its sandbox, and writes the gaps into the pull request so they become decisions instead of surprises.

The same request runs across every C++ repository in an organisation, each in its own sandbox with its own inventory, which is how a dozen CMake projects with a dozen different vendoring habits get consistent update coverage and a consistent list of what is still manual.

Frequently asked questions

Can Dependabot update the vendored catch.hpp?

No. A header copied into the tree has no manifest for Dependabot to read. The pull request names the file and suggests fetching Catch2 through FetchContent or a submodule as a follow-up; a submodule would be tracked by the gitsubmodule ecosystem, which is a one-entry addition to the same config.

What happens to actions pinned to @master?

Nothing. A branch reference has no version to advance, so Dependabot ignores it. The agent leaves the fuzzing workflow as it is because repinning OSS-Fuzz's actions to a tag is a change to how fuzzing runs, not to dependency tracking, and says so in the description.

Will it open one pull request per action?

Not with the groups block: all action updates in a week land in one pull request. For a repository whose only dependencies are a handful of actions, that is typically one pull request a month or less, and a maintainer can split the group later if a particular action needs its own review.

Does Dependabot handle actions pinned to a commit SHA?

Yes. It updates the SHA and the trailing version comment together when a workflow uses that style. This repository pins by tag, so the first pull requests will move tags such as checkout@v4 forward; switching to SHA pins is a separate hardening change the config does not require.

Is a token or secret needed?

No. Dependabot runs with GitHub's own credentials once the file is on the default branch. The only prerequisite is that Dependabot version updates are not disabled by an organisation policy, which the reviewer checks before merging.

More CMake jobs

The same job on other stacks

Keep reading