-
Notifications
You must be signed in to change notification settings - Fork 18
ROX-36649: remove empty commit from patch release #3816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alkmim
wants to merge
1
commit into
master
Choose a base branch
from
alkmim/ROX-36649-remove-empty-commit-step
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+9
−24
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,6 @@ Examples: | |
|
|
||
| Prerequisites: | ||
| - GitHub CLI (gh) must be installed and authenticated | ||
| - User must have "bypass branch protection" permissions on release branches | ||
| EOF | ||
| } | ||
|
|
||
|
|
@@ -335,26 +334,14 @@ main() { | |
| fi | ||
| echo | ||
|
|
||
| # Step 4: Check if release is necessary. | ||
| # Step 4: Determine branch ref and validate patch number. | ||
| # In dry-run mode, use the remote branch ref since we didn't create the worktree. | ||
| local branch_ref="HEAD" | ||
| if [[ "$DRY_RUN" == "true" ]]; then | ||
| branch_ref="origin/${release_branch}" | ||
| log_info "(Using origin/${release_branch} for dry-run checks)" | ||
| fi | ||
|
|
||
| local head_commit_msg | ||
| head_commit_msg=$(git log -1 --format='%s' "$branch_ref") | ||
|
|
||
| if [[ "$head_commit_msg" =~ ^Release\ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| log_warn "Tip of $release_branch is already a release commit: $head_commit_msg" | ||
| if ! confirm "Create another release commit on top?"; then | ||
| log_info "Aborted by user." | ||
| exit 0 | ||
| fi | ||
| echo | ||
| fi | ||
|
|
||
| if [[ "$patch_number" != "$expected_patch" ]]; then | ||
| log_warn "Patch number $patch_number is not sequential." | ||
| log_warn "Latest tag: ${latest_tag:-none}" | ||
|
|
@@ -443,13 +430,14 @@ main() { | |
| echo | ||
| fi | ||
|
|
||
| # Step 8: Create release commit and tag. | ||
| log_info "Creating release commit and tag..." | ||
| # Step 8: Create release tag on the current HEAD of the release branch. | ||
| # Note: this intentionally does NOT create a new commit. Tagging HEAD directly | ||
| # avoids pushing a commit to the protected release branch, so no "bypass branch | ||
| # protection" permission is required (see ROX-36649). | ||
|
Comment on lines
+434
to
+436
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You documenting planning and historical steps, not augmenting the code to facilitate readability. |
||
| log_info "Creating release tag..." | ||
| if [[ "$DRY_RUN" == "true" ]]; then | ||
| log_dry_run "git commit --allow-empty -m \"Release ${version}\"" | ||
| log_dry_run "git tag --annotate --no-sign ${version}" | ||
| else | ||
| git commit --allow-empty -m "Release ${version}" | ||
| git tag --annotate --no-sign "${version}" -m "${version}" | ||
| fi | ||
| echo | ||
|
|
@@ -473,13 +461,12 @@ main() { | |
| echo | ||
| fi | ||
|
|
||
| # Step 10: Push. | ||
| if ! confirm "Push tag and commits to origin? (Requires bypass branch protection)" "y"; then | ||
| # Step 10: Push the tag. | ||
| if ! confirm "Push tag to origin?" "y"; then | ||
| log_info "Aborted by user." | ||
| log_info "To push manually, run from the worktree directory:" | ||
| log_info " cd ${WORKTREE_DIR}" | ||
| log_info " git push origin ${version}" | ||
| log_info " git push --set-upstream origin ${release_branch}" | ||
| log_info "" | ||
| log_info "To clean up the worktree afterwards:" | ||
| log_info " cd ${ORIGINAL_REPO_ROOT}" | ||
|
|
@@ -490,13 +477,11 @@ main() { | |
| exit 0 | ||
| fi | ||
|
|
||
| log_info "Pushing tag and commits..." | ||
| log_info "Pushing tag..." | ||
| if [[ "$DRY_RUN" == "true" ]]; then | ||
| log_dry_run "git push origin ${version}" | ||
| log_dry_run "git push --set-upstream origin ${release_branch}" | ||
| else | ||
| git push origin "${version}" | ||
| git push --set-upstream origin "${release_branch}" | ||
| fi | ||
| echo | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this check?