-
Notifications
You must be signed in to change notification settings - Fork 0
Merge v4-beta to v4 (2026-05-25) #167
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
dbolotin
wants to merge
2
commits into
v4
Choose a base branch
from
merge-2026-05-25
base: v4
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.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/bin/bash | ||
| # | ||
| # fix-beta.sh — re-sync v4-beta with v4 after they diverge. | ||
| # | ||
| # Use when: | ||
| # - Someone committed directly to v4 (bypassing the v4-beta → merge-beta.sh | ||
| # cycle) and you want v4-beta to incorporate those changes. | ||
| # - Post-promotion: v4 has the rename-sed commit from merge-beta.sh that | ||
| # v4-beta does not have; run this script to bring v4-beta back in sync. | ||
| # | ||
| # What it does: | ||
| # 1. Refuses if the working tree is dirty. | ||
| # 2. Re-execs itself from a tmp copy so the script survives the checkout. | ||
| # 3. Switches to v4-beta, pulls latest. | ||
| # 4. Merges v4 in with --strategy-option theirs (v4 content wins on conflict). | ||
| # 5. Sed-flips @v4 -> @v4-beta across action.yaml + .github/workflows/*.yaml | ||
| # (mirrors merge-beta.sh's file scope, opposite direction). | ||
| # 6. Commits the flip on top of the merge commit and pushes. | ||
| # | ||
| # Inverse of merge-beta.sh. | ||
| # | ||
| # Sed safety: @v4 is a prefix of @v4-beta. Naive `s|@v4|@v4-beta|g` would | ||
| # produce @v4-beta-beta. Two scoped patterns are used instead: match @v4 at | ||
| # end-of-line, and @v4 followed by whitespace. | ||
|
|
||
| set -o nounset | ||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| : ${TARGET_BRANCH:="v4-beta"} # branch being fixed | ||
| : ${SOURCE_BRANCH:="v4"} # branch being merged in | ||
|
|
||
| if git status --porcelain | grep -q .; then | ||
| echo "" | ||
| echo "# -------------------------------------------------------------- #" | ||
| echo "# Repository has local changes. Automatic merge is not possible. #" | ||
| echo "# -------------------------------------------------------------- #" | ||
| echo "" | ||
| git status --porcelain | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "${__REAL_RUN:-}" != "true" ]; then | ||
| echo "Copying script to temporary file to not lose original code during checkouts..." | ||
| tmp_script="$(mktemp)" | ||
| cat "${0}" > "${tmp_script}" | ||
| chmod +x "${tmp_script}" | ||
| __REAL_RUN="true" "${tmp_script}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "Updating remote repository info..." | ||
| git fetch --prune origin | ||
|
|
||
| echo "Switching to '${TARGET_BRANCH}'..." | ||
| git checkout "${TARGET_BRANCH}" | ||
| git pull --ff-only | ||
|
|
||
| echo "Merging 'origin/${SOURCE_BRANCH}' into '${TARGET_BRANCH}' (theirs wins on conflict)..." | ||
| git merge \ | ||
| --no-edit \ | ||
| --message "Merge ${SOURCE_BRANCH} into ${TARGET_BRANCH}" \ | ||
| "origin/${SOURCE_BRANCH}" \ | ||
| --strategy-option theirs | ||
|
|
||
| echo "Flipping @${SOURCE_BRANCH} -> @${TARGET_BRANCH} in action.yaml and workflows..." | ||
| { | ||
| find . -type f -name "action.yaml" | ||
| find .github/workflows -type f -name "*.yaml" | ||
| } | | ||
| while read -r file; do | ||
| sed "s|@${SOURCE_BRANCH}\$|@${TARGET_BRANCH}|g; s|@${SOURCE_BRANCH}\([[:space:]]\)|@${TARGET_BRANCH}\1|g" "${file}" > "${file}.tmp" | ||
| mv "${file}.tmp" "${file}" | ||
| done | ||
|
|
||
| if git diff --quiet; then | ||
| echo "No ref flips needed; merge alone was sufficient." | ||
| else | ||
| git add -A | ||
| git commit -m "Re-flip @${SOURCE_BRANCH} -> @${TARGET_BRANCH} after merging ${SOURCE_BRANCH}" | ||
| fi | ||
|
|
||
| echo "Pushing '${TARGET_BRANCH}'..." | ||
| git push origin "${TARGET_BRANCH}" | ||
|
|
||
| echo "Done. ${TARGET_BRANCH} is now in sync with ${SOURCE_BRANCH}, with internal refs restored to @${TARGET_BRANCH}." | ||
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.
mktempis never removed. If${tmp_script}fails mid-run (e.g., merge conflict, push rejected), the script exits viaset -eand the file lingers in/tmp. Adding atrapimmediately after themktempcall ensures cleanup on any exit. The same gap exists inmerge-beta.sh.Prompt To Fix With AI