ci: do not run cd when a branch is created - #1881
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The workflow change is minimal, aligns with the described failure mode, and safely preserves downstream condition evaluation by providing valid default outputs.
Pull request overview
Prevents the CD workflow from publishing packages when a release/** branch is created (which GitHub reports as a push event), by skipping publishable-package detection on branch creation while keeping downstream job conditions safe.
Changes:
- Added a step-level guard (
if: ${{ !github.event.created }}) so detection does not run on branch creation pushes. - Added safe default job outputs (
'[]'/'0') so downstreamfromJson(...)andcontains(...)expressions remain valid even when detection is skipped or produces no outputs.
File summaries
| File | Description |
|---|---|
.github/workflows/cd.yml |
Skips detection on branch creation and provides fallback outputs to avoid downstream expression failures and unintended publishes. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
al3xanndru
approved these changes
Sep 3, 2026
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.



CD triggers on pushes to
mainandrelease/**filtered topackages/*/pyproject.toml. Creating arelease/*branch at a commit that touched one of those files is a push that can match the filter, so the branch creation itself starts a CD run.This repo already resolves safely, because
detect_publishable_packages.pyasks PyPI whether each local version exists and the publish steps useskip-existing: true. The remaining gap is the same as in the sibling repos: if a version bump onmainwas never actually published, branch creation would publish it from a branch nobody treated as a release. Thepypienvironment has no protection rules or deployment branch policy, so there is no second gate.Skip detection on branch creation rather than skipping the whole job. Several downstream jobs use
always(), so a skippeddetect-publishable-packageswould leave them evaluatingfromJson('')and erroring. Falling back to'[]'and'0'in the job outputs keeps the expressions valid and makes every downstreamcontains(...)false, so the tiers skip cleanly. The fallback also covers the case where the script exits without writing its outputs.Manual
workflow_dispatchruns are unaffected, since the property is absent there and evaluates as falsy. Merging a hotfix PR into a release branch is a normal push with commits, socreatedis false and the publish still runs as intended.