Skip to content

Comments

fix(release): complete v0.11.0 automation path#6

Merged
marlon-costa-dc merged 2 commits intomainfrom
release/0.11.0
Feb 20, 2026
Merged

fix(release): complete v0.11.0 automation path#6
marlon-costa-dc merged 2 commits intomainfrom
release/0.11.0

Conversation

@marlon-costa-dc
Copy link
Contributor

@marlon-costa-dc marlon-costa-dc commented Feb 20, 2026

Fix release run to avoid local tag creation when PUSH=0 in release workflow.


Summary by cubic

Automates the release workflow on PR merge for semver branches and prevents local tag creation when PUSH=0, completing the v0.11.0 release path.

  • New Features

    • Added PR_RELEASE_ON_MERGE to dispatch release.yml after a successful merge when the head maps to a version (e.g., 0.11.0-dev, release/0.12.3).
    • Added PR_INCLUDE_ROOT to include the root repo in workspace PR automation.
  • Bug Fixes

    • Release run only creates a tag when push is enabled, avoiding local tags during dry runs or PUSH=0.

Written for commit 89a0bbe. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Added PR_RELEASE_ON_MERGE option to automatically trigger release workflows when PRs are merged (enabled by default).
    • Added PR_INCLUDE_ROOT option to include root repository in workspace PR automation.
  • Bug Fixes

    • Fixed release tag creation to only occur when pushing is enabled.
  • Tests

    • Added comprehensive unit test coverage for release dispatch and tag creation logic.

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@marlon-costa-dc marlon-costa-dc merged commit 9e70848 into main Feb 20, 2026
1 of 2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This change introduces automated release-on-merge functionality to the PR workflow. New configuration variables enable control over release dispatch, while the PR manager script now computes semantic version tags from branch names and conditionally triggers release workflows upon successful merge.

Changes

Cohort / File(s) Summary
Configuration & Targets
Makefile, base.mk
Introduces PR_RELEASE_ON_MERGE (default: 1) and PR_INCLUDE_ROOT variables; propagates these flags to the pr target for downstream consumption.
PR Manager Core Logic
scripts/github/pr_manager.py
Adds three new helper functions: _release_tag_from_head() to extract semver tags from branch names, _is_workspace_release_repo() to detect release workflows, and _trigger_release_if_needed() to dispatch release workflows. Updates _merge_pr() signature to accept head and release_on_merge parameters, implementing post-merge release dispatch conditionally.
Release Script Refactoring
scripts/release/run.py
Moves tag creation logic inside the push-enabled conditional block in _phase_publish(), ensuring tags are only created when pushing is active.
PR Manager Tests
tests/unit/scripts/github/pr_manager_tests.py
Adds two tests: test_release_tag_from_head_patterns() validates branch-to-tag conversion logic; test_merge_triggers_release_dispatch_when_workspace_repo() verifies the complete merge-and-release dispatch sequence.
Release Script Tests
tests/unit/scripts/release/release_shared_and_run_tests.py
Adds two tests: test_phase_publish_does_not_tag_when_push_disabled() and test_phase_publish_tags_when_push_enabled() validate that tag creation respects the push flag.

Sequence Diagram

sequenceDiagram
    participant User
    participant PR Manager
    participant GitHub API
    participant Release Workflow
    participant Repository

    User->>PR Manager: pr merge (with release-on-merge=1)
    PR Manager->>GitHub API: gh pr merge [squash/auto options]
    GitHub API-->>PR Manager: ✓ Merged
    
    rect rgba(100, 200, 100, 0.5)
    Note over PR Manager: Release dispatch logic
    PR Manager->>Repository: Extract tag from head branch
    Repository-->>PR Manager: Computed tag (e.g., v0.11.0)
    
    PR Manager->>Repository: Check for release workflow
    Repository-->>PR Manager: Workflow exists?
    
    alt Workflow exists
        PR Manager->>GitHub API: gh release view [tag]
        GitHub API-->>PR Manager: Release status
        PR Manager->>GitHub API: gh workflow run release.yml
        GitHub API->>Release Workflow: Dispatch workflow
        Release Workflow-->>GitHub API: ✓ Workflow triggered
        PR Manager-->>User: status=release-dispatched
    else Workflow not found
        PR Manager-->>User: Release workflow not available
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A PR merges with a hop and bound,
Release tags spring from the ground!
Workflows dispatch with automated grace,
Versions climb at a quickened pace! 🚀

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch release/0.11.0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/github/pr_manager.py">

<violation number="1" location="scripts/github/pr_manager.py:87">
P2: Inconsistent `-dev` suffix handling: the second regex matches against original `head` instead of the `-dev`-stripped `version`. A branch named `release/X.Y.Z-dev` will silently fail to produce a tag, unlike the bare `X.Y.Z-dev` pattern which is handled correctly.</violation>
</file>

<file name="Makefile">

<violation number="1" location="Makefile:481">
P2: Use `$(POETRY_ENV) python` instead of bare `python` for the root-repo `pr_manager.py` invocation. The orchestrator call on the lines above uses `$(POETRY_ENV)` to ensure the workspace venv is active, but this new direct call doesn't, risking execution under system Python.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

version = head.removesuffix("-dev")
if re.fullmatch(r"\d+\.\d+\.\d+", version):
return f"v{version}"
match = re.fullmatch(r"release/(?P<version>\d+\.\d+\.\d+)", head)
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 20, 2026

Choose a reason for hiding this comment

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

P2: Inconsistent -dev suffix handling: the second regex matches against original head instead of the -dev-stripped version. A branch named release/X.Y.Z-dev will silently fail to produce a tag, unlike the bare X.Y.Z-dev pattern which is handled correctly.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/github/pr_manager.py, line 87:

<comment>Inconsistent `-dev` suffix handling: the second regex matches against original `head` instead of the `-dev`-stripped `version`. A branch named `release/X.Y.Z-dev` will silently fail to produce a tag, unlike the bare `X.Y.Z-dev` pattern which is handled correctly.</comment>

<file context>
@@ -79,6 +80,41 @@ def _selector(pr_number: str, head: str) -> str:
+    version = head.removesuffix("-dev")
+    if re.fullmatch(r"\d+\.\d+\.\d+", version):
+        return f"v{version}"
+    match = re.fullmatch(r"release/(?P<version>\d+\.\d+\.\d+)", head)
+    if match:
+        return f"v{match.group('version')}"
</file context>
Suggested change
match = re.fullmatch(r"release/(?P<version>\d+\.\d+\.\d+)", head)
match = re.fullmatch(r"release/(?P<version>\d+\.\d+\.\d+)", version)
Fix with Cubic

--make-arg "PR_RELEASE_ON_MERGE=$(PR_RELEASE_ON_MERGE)" \
$(SELECTED_PROJECTS)
$(Q)if [ "$(PR_INCLUDE_ROOT)" = "1" ]; then \
python scripts/github/pr_manager.py \
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 20, 2026

Choose a reason for hiding this comment

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

P2: Use $(POETRY_ENV) python instead of bare python for the root-repo pr_manager.py invocation. The orchestrator call on the lines above uses $(POETRY_ENV) to ensure the workspace venv is active, but this new direct call doesn't, risking execution under system Python.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Makefile, line 481:

<comment>Use `$(POETRY_ENV) python` instead of bare `python` for the root-repo `pr_manager.py` invocation. The orchestrator call on the lines above uses `$(POETRY_ENV)` to ensure the workspace venv is active, but this new direct call doesn't, risking execution under system Python.</comment>

<file context>
@@ -471,7 +475,24 @@ pr: ## Manage pull requests for selected projects
+		--make-arg "PR_RELEASE_ON_MERGE=$(PR_RELEASE_ON_MERGE)" \
 		$(SELECTED_PROJECTS)
+	$(Q)if [ "$(PR_INCLUDE_ROOT)" = "1" ]; then \
+		python scripts/github/pr_manager.py \
+			--repo-root "$(CURDIR)" \
+			--action "$(PR_ACTION)" \
</file context>
Suggested change
python scripts/github/pr_manager.py \
$(POETRY_ENV) python scripts/github/pr_manager.py \
Fix with Cubic

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.

1 participant