Repository navigation
feat(ci): monthly uv lock --upgrade opens a pull request - #22
Merged
Merged
Conversation
…request Dependabot's uv updates never move a package whose newest release needs a newer Python than the lock's oldest (SciPy 1.18 and NumPy 2.5 need 3.12, the lock covers 3.11), so CI tested a release users on a newer Python no longer get. `uv lock --upgrade` locks the newest release for each Python (a fork in uv.lock). The Upgrade lock workflow runs on the 1st of each month and by hand, pushes chore/lock-upgrade and opens or updates one pull request when uv.lock changes. A pull request opened with the workflow's token does not start the other workflows, so it starts Tests, Code Quality (now also workflow_dispatch) and Documentation on the branch. The repository setting "Allow GitHub Actions to create and approve pull requests" is needed once; the after-copy message, README and CONTRIBUTING say so.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an Upgrade lock workflow to the template: on the 1st of each month (and by hand, from the Actions tab) it runs
uv lock --upgradeand, whenuv.lockchanges, opens or updates one pull request. James agreed to this on his triage board on 2026-10-20 (cardpython-template-113-lock-forks). Dependabot's configuration is not touched.Why. Dependabot's uv updates never move a package whose newest release needs a newer Python than the lock's oldest. SciPy 1.18 and NumPy 2.5 need Python 3.12 and the lock covers 3.11, so CI tested a SciPy that users on 3.12 and newer no longer get (jmineau/fips#113).
uv lock --upgradelocks the newest release for each Python as a fork inuv.lock.What the workflow does (
template/.github/workflows/lock-upgrade.yml.jinja)uv lock --upgradeonmain. Ifuv.lockis unchanged, it stops.uv.lockto the branchchore/lock-upgrade(force-pushed; the branch belongs to the workflow, so last month's open pull request is replaced by this month's), opens the pull request or updates the body of the open one, and lists whatuvupdated in the body (for exampleUpdated scipy v1.16.3 -> v1.17.1, v1.18.1, the fork).actions/checkout,astral-sh/setup-uvand theghCLI, likedocs.ymlandpublish.yml; no third-party pull-request action.contents: readfor the workflow; the one job addscontents: write(push the branch),pull-requests: writeandactions: write(see the next paragraph). The token is in the environment of the one step that needs it, and checkout keeps no credentials.template/.github/zizmor.yml,unpinned-uses: ref-pin) and CONTRIBUTING.md choose tags kept current by Dependabot over commit SHAs. I did not change that.CI on the pull request. A pull request opened with the default
GITHUB_TOKENdoes not start thepull_requestworkflows (GitHub's rule against workflows triggering workflows;workflow_dispatchis the exception). So the workflow starts Tests, Code Quality and Documentation on the branch withgh workflow run ... --ref chore/lock-upgraderight after the push; their results show on the pull request. This is the simplest thing that works with no secret: Code Quality gets aworkflow_dispatchtrigger for it (Tests and Documentation already had one; the deploy job of Documentation does not run on a branch). Alternatives, not taken: a personal access token or GitHub App secret in each repository (then CI starts by itself, but seven secrets to rotate), or closing and reopening the pull request by hand each month.One-time setup per package.
gh pr createwith the default token needs the repository setting Settings > Actions > General > Workflow permissions > "Allow GitHub Actions to create and approve pull requests". It is off in all seven package repositories (read through the API today). The after-copy message, the README's retrofit steps and the generated CONTRIBUTING.md say so. Without it GitHub refuses to create the pull request, so that step fails after the branch is pushed (not tried). This is on the triage board for James (cardpython-template-22-actions-create-prs).Dependabot. Its monthly uv PR and this one both change
uv.lock; after one merges, the other is rebased (Dependabot rebases its own; this workflow rebuilds its branch each month). Dependabot waits 7 days after a release before using it.uv lock --upgradetakes the newest release at the moment it runs. The cooldown cannot be added with--exclude-neweron the command line: uv records it inuv.lock, and thenuv sync --lockedreports the lock as out of date (tried with uv 0.12.23). Puttingexclude-newer = "7 days"under[tool.uv]would work but is a template-wide change; the choice is on the triage board (cardpython-template-22-lock-upgrade-cooldown). The pull request is reviewed and tested before it merges either way.Checked (python-template
just teston a compute node: both bakes,docs_notebooksandpublish_to_pypiyes and no; in each,quality-check,build-docs, every pre-commit hook including zizmor on the new workflow,dist, the version checks)just testpassed: "All checks passed for both variants." (the zizmor hook passed in both bakes)zizmor1.30.1 (--offline) andactionlinton the baked.github: no findings.gh: a project locked in January and upgraded today (changed: branch pushed,gh pr create, threegh workflow run; unchanged: stops with no output; an open pull request:gh pr editinstead of create;uv lockfailing: the step fails). Theuvoutput and the pull request body are as described above.Not checked. The workflow has not run on GitHub:
workflow_dispatchonly works for a workflow file on a repository's default branch, and the template repository has nouv.lock. The first real run happens in a package aftercopier update(suggest fips first, thengh workflow run lock-upgrade.ymlonce the setting above is on).copier updatewas not run on any package. I did not test that GitHub shows the dispatched runs' results on the pull request (it attaches them to the head commit); check this on the first run.Other open python-template PRs: #20 (
template/AGENTS.md.jinja) and the doctests PR (#21:pyproject.toml.jinja,AGENTS.md.jinja,CONTRIBUTING.md.jinja,README.md,justfile). I merged this branch with each in a scratch test merge: no conflicts (README.md andCONTRIBUTING.md.jinjaare edited in different places by the doctests PR).