Skip to content

chore: Ensure release PRs pass checks after generated updates#1244

Merged
hatayama merged 4 commits into
v3-betafrom
feature/hatayama/add-release-pr-check-command
May 30, 2026
Merged

chore: Ensure release PRs pass checks after generated updates#1244
hatayama merged 4 commits into
v3-betafrom
feature/hatayama/add-release-pr-check-command

Conversation

@hatayama

Copy link
Copy Markdown
Owner

Summary

  • Release PRs now stay in draft while generated native CLI updates are followed by the same build-and-test workflow used for normal PRs.
  • Release automation now refuses to mark a release PR ready if its head commit changed while checks were running.

User Impact

  • Maintainers can add more release contents over time without merging a release PR that only passed checks before generated files changed.
  • Failed or stale generated release updates are caught before the release PR becomes ready to merge.

Changes

  • Add Go-based release PR check dispatch automation for the v3-beta release workflow.
  • Draft release PRs during native CLI dist sync and check dispatch, then mark them ready only after the matching workflow run succeeds.
  • Guard same-second GitHub workflow timestamps and head-SHA changes before marking the PR ready.
  • Document Go as the preferred language for non-trivial CI automation.

Verification

  • go -C Packages/src/Cli~ test ./internal/automation
  • go -C Packages/src/Cli~ test ./...
  • scripts/test-release-please-config.sh
  • scripts/test-sync-release-please-go-cli-dist.sh
  • scripts/check-go-cli.sh
  • codex-review v3-beta

hatayama added 3 commits May 30, 2026 16:06
Run the existing build-and-test workflow against the final release PR head after release-please updates generated content. Keep release PRs in draft while generated files and dispatched checks are pending so they cannot be merged before the verified head is ready.
Keep release PR checks tied to the exact head commit so a newly updated release PR cannot be marked ready from stale workflow results. Also scope the Go release automation to the v3-beta release path and accept GitHub workflow timestamps rounded to seconds.
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a896d15a-29fe-4252-aec9-311af94d5ed5

📥 Commits

Reviewing files that changed from the base of the PR and between 368aeeb and a185c94.

📒 Files selected for processing (1)
  • scripts/test-release-please-config.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/test-release-please-config.sh

📝 Walkthrough

Walkthrough

This PR adds automated release-please PR checks that orchestrate a GitHub Actions workflow: finding pending release PRs, drafting them, dispatching build/test workflows, polling for completion, and marking them ready. The logic is implemented in Go, integrated into the v3-beta release workflow, and the release distribution sync script is updated to draft PRs before syncing files.

Changes

Release PR Checks Automation

Layer / File(s) Summary
Release PR Checks Orchestration and Tests
Packages/src/Cli~/internal/automation/release_pr_checks.go, Packages/src/Cli~/internal/automation/release_pr_checks_test.go
Core RunReleasePleasePRChecks function loads config from environment, finds the exactly one open PR labeled autorelease: pending with release-please branch naming, marks it draft, dispatches the workflow, polls for the matching run, watches it to completion, verifies the PR head SHA is unchanged, and marks it ready. Comprehensive test suite covers skip, success, time handling, branch filtering, and failure scenarios with a mock gh CLI environment.
Command Entrypoint and Version Warning Integration
Packages/src/Cli~/cmd/dispatch-release-please-pr-checks/main.go, Packages/src/Cli~/internal/automation/minimum_version_warning.go, Packages/src/Cli~/internal/automation/minimum_version_warning_test.go
Entry point main wires context and OS streams to RunReleasePleasePRChecks, exiting with its status. Minimum-version warning system is extended to classify changes under cmd/dispatch-release-please-pr-checks/ as Go CLI changes, with test coverage validating the classification.
Workflow Configuration and Dispatch Steps
.github/workflows/release-please.yml, scripts/test-release-please-config.sh
Workflow permissions grant actions: write, the Go setup step is renamed to "release PR automation", and a new conditional "Dispatch release PR checks" step is added for v3-beta that runs when checks are not blocked and invokes go run ./cmd/dispatch-release-please-pr-checks. Test helper functions validate step presence, conditional expressions, and ordering relative to the sync step.
Release Distribution Sync Updates and Tests
scripts/sync-release-please-go-cli-dist.sh, scripts/test-sync-release-please-go-cli-dist.sh
The sync script now drafts the release PR (via gh pr ready --undo) before syncing native CLI dist files. Mock gh in the test harness gains pr ready command handling with logging, and two test cases verify the script invokes gh pr ready --repo ... --undo with expected arguments.
CI Automation Language Guidelines
AGENTS.md
Documents that Go should be used for logic requiring JSON parsing, workflow polling, state transitions, or non-trivial branching, with shell scripts restricted to thin wrappers or simple sequences.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1224: Modifies minimum-version warning classification and tests for Go CLI automation sources, related to the warning changes here.
  • hatayama/unity-cli-loop#1081: Related changes to the release-please Go CLI dist sync tests and sync flow; similar test harness adjustments for gh command handling.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main objective: ensuring release PRs pass checks after generated updates, which aligns with the core changes across workflow files, automation scripts, and Go modules.
Description check ✅ Passed The description is directly related to the changeset, explaining the release PR automation improvements, the rationale, user impact, and listing all major categories of changes included in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/hatayama/add-release-pr-check-command

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.

@cubic-dev-ai cubic-dev-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.

2 issues found across 10 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/sync-release-please-go-cli-dist.sh
Comment thread scripts/test-release-please-config.sh Outdated
Search each release workflow step until the next step header so valid checks do not fail when a step grows beyond the previous fixed line window.
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