From 77235d059fec03c5dad4f19b35d4100ae91daea6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 19 Sep 2026 00:23:10 +0000 Subject: [PATCH 1/2] Initial plan From cbb843078f329e2c191b279a3f9939dff3f541fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 19 Sep 2026 00:25:15 +0000 Subject: [PATCH 2/2] Retry release branch merge pushes Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- .../scripts/test-merge-main-into-release.sh | 6 +++++ .github/workflows/update-release-branch.yml | 24 +++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/scripts/test-merge-main-into-release.sh b/.github/scripts/test-merge-main-into-release.sh index cce4b78e0..b3587edae 100644 --- a/.github/scripts/test-merge-main-into-release.sh +++ b/.github/scripts/test-merge-main-into-release.sh @@ -7,6 +7,7 @@ unset GITHUB_STEP_SUMMARY SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" HELPER="$SCRIPT_DIR/merge-main-into-release.sh" +WORKFLOW="$SCRIPT_DIR/../workflows/update-release-branch.yml" TEST_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/release-sync-tests.XXXXXX")" trap 'cd "$SCRIPT_DIR"; rm -rf -- "$TEST_ROOT"' EXIT @@ -15,6 +16,11 @@ fail() { exit 1 } +grep -Fq 'for attempt in {1..3}; do' "$WORKFLOW" || fail "Release workflow does not retry rejected pushes." +grep -Fq 'git checkout -B "$BRANCH" "origin/$BRANCH"' "$WORKFLOW" || fail "Release workflow does not refresh the release branch before retrying." +grep -Fq 'if git push origin "HEAD:refs/heads/$BRANCH"; then' "$WORKFLOW" || fail "Release workflow does not handle rejected pushes." +echo "PASS: workflow retries release branch push races" + write_file() { mkdir -p -- "$(dirname -- "$1")" printf '%s\n' "$2" > "$1" diff --git a/.github/workflows/update-release-branch.yml b/.github/workflows/update-release-branch.yml index 5c6dcfcf3..546e75235 100644 --- a/.github/workflows/update-release-branch.yml +++ b/.github/workflows/update-release-branch.yml @@ -81,11 +81,21 @@ jobs: run: | set -euo pipefail - git fetch origin main - MAIN_SHA="$(git rev-parse origin/main)" + for attempt in {1..3}; do + git fetch origin main "$BRANCH" + git checkout -B "$BRANCH" "origin/$BRANCH" + MAIN_SHA="$(git rev-parse origin/main)" - # Checkout is on release; always run the helper from the pinned main - # commit, including when release has not received the helper yet. - git show "$MAIN_SHA:.github/scripts/merge-main-into-release.sh" > "$RUNNER_TEMP/merge-main-into-release.sh" - bash "$RUNNER_TEMP/merge-main-into-release.sh" "$MAIN_SHA" "$BRANCH" - git push origin "HEAD:refs/heads/$BRANCH" + # Always run the helper from the pinned main commit, including when + # release has not received the helper yet. + git show "$MAIN_SHA:.github/scripts/merge-main-into-release.sh" > "$RUNNER_TEMP/merge-main-into-release.sh" + bash "$RUNNER_TEMP/merge-main-into-release.sh" "$MAIN_SHA" "$BRANCH" + if git push origin "HEAD:refs/heads/$BRANCH"; then + exit 0 + fi + + echo "::warning::Release branch changed while syncing; retrying ($attempt/3)." + done + + echo "::error::Unable to push release sync after 3 attempts." + exit 1