Skip to content

ci: release only commits whose CI passed - #52

Merged
uniqueg merged 2 commits into
devfrom
ci/release-check-ci
Nov 1, 2026
Merged

uniqueg merged 2 commits into
devfrom
ci/release-check-ci

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

The prepare job ("Prepare release") of release.yml now fails unless a successful run of ci.yml exists for a push of the tagged commit; the step, API query and error text are those of the other repos' release workflows. prepare gets actions: read at job level only. attest and pypi/publish all need prepare. docs/releasing.md documents the check, the fast-forward requirement and the recovery.

Closes #51

Verification

  • actionlint and zizmor --offline on the workflows: no findings.
  • The repo has no tests for its workflows (tests/test_release.py tests scripts/release.py, unchanged); the step cannot run before a tag. Verified by review only, with the same query as the reference repos.
  • Not run: the release workflow itself (needs a tag).

Lane

Regular lane (release workflow): adversarial and quality review, one round. No high or medium correctness findings; fixes were comments and docs only.

Declined review findings

  • Test of the failure path / move the check into scripts/release.py (quality, medium): declined; the step is the same shell step as in the reference repos, and a stubbed test would only test the stub.
  • || true around the API call to always print the hint: declined; an API error fails safely.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Require successful CI for the tagged commit before preparing a release and document the updated release procedure.

Bug Fixes:

  • Prevent releases from proceeding unless the tagged commit has a successful CI workflow run.

Enhancements:

  • Restrict the release preparation job to the permissions required to inspect repository contents and workflow runs.

Documentation:

  • Document the CI validation requirement, fast-forward release constraint, and recovery steps for expired or missing CI runs.

uniqueg and others added 2 commits November 1, 2026 21:23
The release workflow now fails in the prepare job unless a successful run of ci.yml exists for a push of the tagged commit, so nothing is published for a commit whose CI failed or never ran. The error says to re-run the workflow once CI passed. Docs updated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The release workflow now fails before building or publishing unless the tagged commit has a successful push-triggered ci.yml run, using least-privilege read permissions; release documentation explains the fast-forward constraint and recovery options.

Sequence diagram for CI validation before release preparation

sequenceDiagram
    participant Tag as Release tag
    participant Prepare as prepare job
    participant GitHub as GitHub Actions API
    participant CI as ci.yml push run
    participant Build as Package build
    participant Publish as Release jobs

    Tag->>Prepare: Trigger release workflow
    Prepare->>GitHub: gh api actions/workflows/ci.yml/runs
    GitHub-->>Prepare: Successful push runs for GITHUB_SHA
    alt Successful CI run exists
        Prepare->>Build: Build distributions
        Build-->>Prepare: Build outputs
        Prepare->>Publish: Enable attest and pypi/publish
    else No successful run or CI still running
        Prepare-->>Tag: Fail and request workflow re-run after CI passes
    end
Loading

File-Level Changes

Change Details Files
Gate release preparation on a successful CI run for the exact tagged commit.
  • Query GitHub Actions for a successful ci.yml push run matching GITHUB_SHA.
  • Fail safely with remediation guidance when CI is absent, running, or unsuccessful.
  • Grant prepare only read access to repository contents and workflow runs.
.github/workflows/release.yml
Document the commit lineage and recovery requirements introduced by CI validation.
  • Require the tagged release commit to remain a fast-forward from main and have CI run for the corresponding push to dev.
  • Explain rerunning CI or releasing a newer commit when the run is missing or expired.
  • Update the release workflow description to include the CI prerequisite.
docs/releasing.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 foca-plugins | 🛠️ Build #35565172 | 📁 Comparing 17a067b against latest (03c3c28)

  🔍 Preview build  

1 file changed
± releasing/index.html

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (03c3c28) to head (17a067b).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev       #52   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          553       553           
  Branches        71        71           
=========================================
  Hits           553       553           
Flag Coverage Δ
foca-plugin-generic-example-noop 100.00% <ø> (ø)
foca-plugin-generic-routing-random 100.00% <ø> (ø)
foca-plugin-tes-routing-distance 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 20:37

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Linked issues

#51 ci: release only commits whose CI passed · 4 of 4 met

# Requirement Status Notes
1 Fail prepare unless a successful ci.yml run exists for a push of the tagged commit, and tell the user to re-run the workflow once CI has passed. ✅ Met The step queries successful ci.yml push runs for GITHUB_SHA and fails with the requested re-run guidance if none exists.
2 Require prepare for every publishing job. ✅ Met attest, pypi, and publish depend on prepare directly or through their job dependencies.
3 Add workflow tests where the repository tests its workflows. ✅ Met The repository has no workflow tests, so no workflow test applies to this change.
4 Update the release documentation. ✅ Met docs/releasing.md explains the CI check, fast-forward requirement, and recovery steps.

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit b550234 into dev Nov 1, 2026
112 checks passed
@uniqueg
uniqueg deleted the ci/release-check-ci branch November 1, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: release only commits whose CI passed

1 participant