feat: enhance release workflow with cherry-pick version sync to main#53
feat: enhance release workflow with cherry-pick version sync to main#53frontegg-david merged 4 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughAdds outputs to the Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub Actions
participant Git as Git Repository
participant API as GitHub API
GH->>GH: publish job completes\noutputs: version, is_prerelease, branch
alt not dry run & not prerelease
GH->>Git: checkout + fetch tags
GH->>Git: determine latest stable semver
alt released version is latest
GH->>Git: configure git credentials
GH->>Git: locate version-bump commit on release branch
GH->>Git: create cherry-pick branch from default branch
GH->>Git: attempt cherry-pick of version-bump
alt cherry-pick succeeds
GH->>Git: commit & push cherry-pick branch
GH->>API: create PR with labels and body
API-->>GH: PR created
else cherry-pick conflicts
GH->>Git: abort cherry-pick
GH->>API: create issue with manual guidance
API-->>GH: Issue created
end
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish-release.yml:
- Around line 516-560: Before creating the cherry-pick branch, detect whether
VERSION_COMMIT (or the version bump) is already present on the DEFAULT_BRANCH
and exit cleanly if so; after fetching origin and checking out DEFAULT_BRANCH,
run a reachability check like git merge-base --is-ancestor "$VERSION_COMMIT"
"origin/$DEFAULT_BRANCH" (or git branch --contains "$VERSION_COMMIT"
"origin/$DEFAULT_BRANCH") and if it returns success echo a message and skip
creating CHERRY_BRANCH/PR, otherwise continue with creating "$CHERRY_BRANCH" and
performing the cherry-pick as currently implemented.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish-release.yml:
- Around line 531-567: The cherry-pick failure path treats any non-zero exit
from git cherry-pick "$VERSION_COMMIT" --no-commit as a conflict, but git can
fail because the change is already applied (an "empty" cherry-pick); capture the
cherry-pick output/exit code, detect the empty case (e.g., output contains
"previous cherry-pick is now empty" or "The previous cherry-pick is now empty")
or check for no staged/working changes (git diff --cached --name-only and git
status --porcelain empty), and if empty then run git cherry-pick --abort, echo a
no-op message and exit successfully instead of creating an issue; otherwise keep
the existing git cherry-pick --abort || true and the conflict warning/issue
creation (references: VERSION_COMMIT, git cherry-pick, CHERRY_BRANCH).
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/publish-release.yml (2)
466-482: Minor race consideration with concurrent releases from different branches.If two stable releases from different release branches (e.g.,
release/2.11.xandrelease/2.12.x) run concurrently, both may determine they are the "latest" before the other's tag is pushed, potentially creating duplicate cherry-pick PRs.This is unlikely in practice and the outcome is benign (one PR becomes redundant), but worth noting. The existing per-branch concurrency group at line 31 doesn't prevent this since it's scoped to
github.ref.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish-release.yml around lines 466 - 482, The race comes from computing LATEST from local tags; change the logic to compute the highest stable tag from the remote instead and ensure tags are fetched first: run git fetch origin --tags, then derive LATEST from the remote tag list (e.g., use git ls-remote --tags origin and extract tag names, grep '^vX.Y.Z$', sort -V, tail -1, sed 's/^v//') and then compare that remote LATEST against VERSION to set is_latest (variables: LATEST, VERSION, is_latest and the current local git tag pipeline) so concurrent workflows use the authoritative remote tag state rather than local tags.
534-538: Consider usinggit reset --hardorgit cherry-pick --abortfor cleaner state.
git reset HEADonly unstages changes but leaves modified files in the working directory. While this won't cause issues in CI (the runner is ephemeral), using--hardor--abortwould be more explicit about discarding the incomplete cherry-pick state.♻️ Suggested fix
if [ -z "$(git diff --cached --name-only)" ]; then echo "Cherry-pick produced no changes — version bump already applied on $DEFAULT_BRANCH" - git reset HEAD 2>/dev/null || true + git cherry-pick --abort 2>/dev/null || true exit 0 fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish-release.yml around lines 534 - 538, Replace the current cleanup step that runs "git reset HEAD 2>/dev/null || true" inside the block that checks "git diff --cached --name-only" with a more explicit discard of the incomplete cherry-pick state: first attempt "git cherry-pick --abort" and, if that fails, fallback to "git reset --hard" (both silenced similarly), so the script aborts a partial cherry-pick or otherwise hard-resets the working tree instead of only unstaging changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/publish-release.yml:
- Around line 466-482: The race comes from computing LATEST from local tags;
change the logic to compute the highest stable tag from the remote instead and
ensure tags are fetched first: run git fetch origin --tags, then derive LATEST
from the remote tag list (e.g., use git ls-remote --tags origin and extract tag
names, grep '^vX.Y.Z$', sort -V, tail -1, sed 's/^v//') and then compare that
remote LATEST against VERSION to set is_latest (variables: LATEST, VERSION,
is_latest and the current local git tag pipeline) so concurrent workflows use
the authoritative remote tag state rather than local tags.
- Around line 534-538: Replace the current cleanup step that runs "git reset
HEAD 2>/dev/null || true" inside the block that checks "git diff --cached
--name-only" with a more explicit discard of the incomplete cherry-pick state:
first attempt "git cherry-pick --abort" and, if that fails, fallback to "git
reset --hard" (both silenced similarly), so the script aborts a partial
cherry-pick or otherwise hard-resets the working tree instead of only unstaging
changes.
Summary by CodeRabbit
Chores
New Features