Repository navigation
ci: prepend custom notes to generated notes - #543
Conversation
Port cloud-registry's scripts/release_notes.py: `check` checks curated notes (docs/releases/<version>.md) against the agreed format, `body` prepends them to GitHub's generated notes under "## Commits", without the "## What's Changed" header and with the "**Full Changelog**" line last, and `require` fails if a release lacks notes once another release has them. The `first` command is left out, as FOCA has published releases. The version guard allows curated notes to name their release. Refs #539 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The release workflow checks the curated notes of the release in the build job, before anything is published (missing although required, TODO, format), and the publish job creates the draft and publishes it with the curated notes followed by GitHub's generated ones, as cloud-registry does. A re-run on a draft replaces its notes rather than adding to them; a published release keeps its notes. The CI job "Release readiness" runs the same checks for the version in CITATION.cff while it is not tagged (warnings on pull requests). Refs #539 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the format, where the notes go (docs/releases/X.Y.Z.md, the mkdocs nav and the changelog), that they are part of the pull request that sets the citation metadata, and the checks. Add the notes of 0.18.0 from its published release (without the periods after the numbers and with a versioned link, as the check requires), so that notes are required from the next release on. Closes #539 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Flag links to the root of the docs, which redirect to a version that moves; turn all error annotations of the readiness job into warnings on pull requests; rewrap the contributing guide. Refs #539 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThis PR introduces validated, versioned curated release notes and integrates them into release publication by composing them ahead of GitHub-generated notes, while adding CI readiness checks, workflow safeguards, documentation, and backfilled 0.18.0 notes. Sequence diagram for release notes publicationsequenceDiagram
participant ReleaseWorkflow
participant GitHubAPI
participant ReleaseNotes
participant GitHubRelease
ReleaseWorkflow->>ReleaseNotes: require VERSION
ReleaseWorkflow->>ReleaseNotes: check curated notes
ReleaseWorkflow->>GitHubAPI: generate-notes TAG
GitHubAPI-->>ReleaseWorkflow: generated notes
ReleaseWorkflow->>ReleaseNotes: body curated generated
ReleaseNotes-->>ReleaseWorkflow: composed notes
ReleaseWorkflow->>GitHubRelease: create --notes-file
ReleaseWorkflow->>GitHubRelease: upload assets
ReleaseWorkflow->>GitHubRelease: edit --notes-file --draft=false
Flow diagram for release readiness checksflowchart TD
A[CITATION.cff version] --> B{Version tagged elsewhere?}
B -->|Yes, different commit| C[Skip readiness checks]
B -->|No, or tagged commit| D[require curated notes]
D --> E[Check for TODO]
E --> F[check notes format and moving links]
F --> G{Pull request?}
G -->|Yes| H[Emit warnings]
G -->|No, push to dev| I[Fail on findings]
I --> J[CI passed gate]
H --> J
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #543 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 55 55
Lines 6667 6667
=========================================
Hits 6667 6667
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/ci.yml" line_range="371" />
<code_context>
+ # The commit of the (annotated) tag, if any: later commits are
+ # skipped, but not the tagged commit itself (e.g., if it was
+ # tagged before this job ran)
+ tagged="$(git ls-remote origin "refs/tags/v${version}^{}" | cut -f1)"
+ if [[ -n "${tagged}" && "${tagged}" != "${SHA}" ]]; then
+ echo "v${version} is tagged: no release in preparation"
</code_context>
<issue_to_address>
**Lightweight tags stay undetected**
When the release tag is lightweight and later pushes to `dev` occur while `CITATION.cff` still names that version, `git ls-remote` finds only the peeled ref, which lightweight tags do not have, so readiness treats the already-released version as untagged and continues checking its notes on later pushes; changed or removed notes can then fail the CI gate.
Check both the direct tag ref and its peeled ref when detecting whether the version is tagged.
</issue_to_address>
### Comment 2
<location path="scripts/release_notes.py" line_range="373" />
<code_context>
+ findings = _Checker().run(lines) + [
+ Finding(number, MOVING_LINK)
+ for number, line in enumerate(lines, start=1)
+ if UNVERSIONED.search(line)
+ ]
+ return sorted(findings, key=lambda finding: finding.line)
</code_context>
<issue_to_address>
**Relative links break in releases**
When curated notes contain a relative link to a docs page or file, `check` only searches for `UNVERSIONED` links, so it accepts relative links and publishes them unchanged. GitHub resolves them from the release page rather than the documentation site, leaving readers with broken or incorrect links.
Reject relative Markdown links in curated notes.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and a malformed or misleading curated note can be published publicly as part of a release, alongside GitHub’s generated notes. Reverting the workflow prevents future use but does not retract notes already published with a release.
Blocking findings: .github/workflows/ci.yml:371, scripts/release_notes.py:373
Reject relative links in curated release notes, which do not resolve in GitHub releases, and detect lightweight release tags in the readiness job too. Refs #539 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
The release workflow now publishes the curated release notes followed by GitHub's generated notes, as cloud-registry's does, so a release needs no editing on GitHub afterwards.
scripts/release_notes.py, ported from cloud-registry, with its tests intests/test_release_notes.py:checkchecks curated notes (docs/releases/<version>.md) against the agreed format.bodybuilds the release body: the curated notes, then## Commitswith the generated notes (without## What's Changed), then the**Full Changelog**line last.requirefails if a release has no notes while other releases do.firstcommand is left out, because FOCA already has published releases. The previous tag stays GitHub's choice, as with--generate-notesbefore.https://foca.readthedocs.io/,/en/) are flagged as links to a version that moves. This is an addition on top of CR, from review.release.yml:TODO, or are not in the format.generate-notesAPI plusbody, and are passed with--notes-filetocreateand to the finaledit.ci.yml: a new job, "Release readiness", copied from CR without its pin check. It runs the same checks for the version inCITATION.cffwhile that version is untagged, or on the tagged commit itself:dev, they are errors.The job is in the
CI passedgate'sneeds, so the ruleset doesn't change.Docs:
docs/contributing.mdhas a new "Release notes" section: the format, where the notes go (docs/releases/X.Y.Z.md, thenavofmkdocs.yml, the changelog), that they belong in the PR that sets the citation metadata, and the checks.docs/releases/*.mdto name their release.docs/releases/0.18.0.mdis backfilled from the published v0.18.0 body. Two changes were needed to pass the check: the periods after the reference numbers are removed, and the/en/latest/link is now/en/v0.18.0/. With this file in place, notes are required from the next release on, as in CR.Verification
ruff check,ruff format --check,mypy(134 files) andast-grep scan: clean.pytest -m "not mongodb": 2921 passed. The MongoDB tests did not run locally because no server is on :12345; CI runs them.tests/test_release_notes.py: coversscripts/release_notes.pyfully, apart from the__main__guard, whichtest_scriptexercises in a subprocess.mkdocs build --strict: passes. A notes file that is missing from thenavfails the build (checked by hand).actionlint: one finding, SC2102 atci.yml:56, which is in the lint job and was already ondev.zizmor --offline: the same 19 findings as ondev, 12 of them suppressed.gh, 28/28 checks passed. The script isdryrun.shin thefoca-539-dryrunfolder of the work folder. It runs therun:scripts of the changed steps from the workflow files underbash -e, with aghstub that logs its calls and returns canned JSON.--notes-fileand no--generate-notes, uploads, then publishes with the same notes. The body is exactly: curated notes,## Commits, the generated list including New Contributors, and the Full Changelog line last.TODO, a bad format and a/en/latest/link each fail; valid notes pass.CI passed. "Chart install" failed once, when the Helm test pod in kind timed out (the PR changes no charts). It passed on the re-run of the failed jobs.Review
The adversarial and quality reviewers found nothing high or medium. Fixed lows:
::error::annotations of the readiness job were not turned into warnings on PRs;Sourcery raised two points, both fixed in 4b5f407, and both threads are resolved:
checknow rejects relative links.The dry run now has 30/30 checks, the extra two covering lightweight tags. CI passed again on 4b5f407.
Declined review findings
naventry is enforced, by the strict docs build. This matches CR; adding a check is out of scope.notfoca.readthedocs.io/en/latest/is flagged too. It is a false positive on a contrived input, and CR has the same pattern, so I left it as it is for parity.Closes #539
🤖 Generated with Claude Code
Summary by Sourcery
Automate validated, curated release notes alongside GitHub-generated changes throughout the release workflow.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: