Software factory / Runs
Update the CI pins of the workflows
Your workflows import shared CI steps with src: imports, pinned to a commit in .source/src.lock. The repository of the steps puts out new versions, and a pin stays at its old commit until someone moves it. You want to see which pins are behind, and get a pull request that moves them.
4 min read
The CI pins card of the Dependencies tab does this. Code reads the version of each pin, finds its newest commit, rewrites the imports and src.lock, and opens the pull request. No agent and no model is necessary.
You need a repository whose workflows import a shared module, and write access for step 2.
1. Read the CI pins card
Open the Dependencies tab of the repository (/@<owner>/<repo>/dependencies). The tab shows when the default branch has a package.json or a .source/src.lock at its root.
The CI pins card has one row for each src: import of the workflows of the default branch:
The module repository and the ref that the import names, like
acme/ci-steps@3f2a1b9.Pinned at: the commit that
src.lockpins.Follows: the version of the pin. The comment at the end of the import line names it, as
src ci update --pinwrites it:import { pnpmInstall } from 'src:acme/ci-steps@3f2a1b9c0d4e5f60718293a4b5c6d7e8f9012345/pnpm.ts' // v1.0.0An import of a tag or a branch follows that tag or branch. A commit pin with no comment follows the newest version tag of the module repository (
1.2.0orv1.2.0), or its default branch when it has none.The state:
- Up to date: the pin is at the newest commit of its version.
- tag v1.2.0 is out (yellow): a newer commit of the version is out, with a link to it.
- Can't read the repository: you can't read the module repository, so the card says nothing more about it.
- Not checked: the version names no tag or branch of the module repository. Point at the reason to read it.
Which tag is newest: a version tag has a prefix and numbers, like v1.2.0, 1.2.0 or ci-steps-v2. A pin follows the newest tag with the same prefix. A prerelease such as v2.0.0-rc.1 counts only for a pin that follows a prerelease. A tag with no numbers, like stable, is followed as it is: when it moves, its new commit is newest. A branch is followed to its tip.
2. Update the pins
Click Update on the row of a module repository to move its pins. With pins of more than one repository behind, Update all moves all of them in one pull request.
The update:
- Moves each import that is behind to the newest commit of its version, and writes that version in the comment of the line.
- Writes
.source/src.lockagain, with the commit, the tree and the hash of the files of each import. An import inside a module that has no pin yet is pinned to the commit its ref points at now. - Commits both as the bot, on the branch
factory/ci-pins/all, orfactory/ci-pins/repos/<owner>/<repo>for one repository. - Opens a pull request from the branch into the default branch, as the bot. When that pull request is open already, the update adds its commit to it.
The card shows the number of the pull request. An update checks the new pins as a plan does: a commit that no branch or tag of its repository holds, a module repository that your repository may not import, or a ref that moved stops it, and the card shows why.
3. Review and merge the pull request
The pull request's Workflow imports box shows the tag or the branch of each new commit (see Pin shared modules to commits). Its checks run with the new code of the modules. They are trusted and start without an approval, as for the pull requests of the dependency agent (see Trust levels). Merge it when they pass.
From src, REST or MCP
| You want to | src | REST | MCP |
|---|---|---|---|
| See the CI pins | src deps pins | GET /api/v1/repos/{owner}/{repo}/factory/dependencies/ci-pins | get_ci_pins |
| Update the pins of every repository | src deps pin | POST .../factory/dependencies/ci-pins/update | update_ci_pins |
| Update the pins of one repository | src deps pin <owner>/<repo> | POST .../factory/dependencies/ci-pins/update with {"repository": "<owner>/<repo>"} | update_ci_pins with repository |
src deps pins
acme/ci-steps@3f2a1b9c0d4e5f60718293a4b5c6d7e8f9012345 3f2a1b9 behind: tag v1.2.0 is at 9c1d2e3
Run `src deps pin` to move it in a pull request.
src deps pin acme/ci-steps
12
✓ Opened pull request #12 of acme/app: it moves 1 CI pin (branch factory/ci-pins/repos/acme/ci-steps).
src deps pins --json pins,commit gives each pin with its fields. The card and the commands check at most 20 pins; past that, more counts the rest.