From 01dd8f0c5696ca430d46c1bd291900ab6c5f821e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 17:41:56 +0000 Subject: [PATCH] Add promote-unstable-to-stable GitHub Actions workflow Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/2b392fc9-f726-4e04-8192-a0812f7c00b6 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- .../workflows/promote-unstable-to-stable.yml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/promote-unstable-to-stable.yml diff --git a/.github/workflows/promote-unstable-to-stable.yml b/.github/workflows/promote-unstable-to-stable.yml new file mode 100644 index 00000000..40b3eb45 --- /dev/null +++ b/.github/workflows/promote-unstable-to-stable.yml @@ -0,0 +1,87 @@ +name: Promote Unstable to Stable + +# This workflow is MANUAL-ONLY. +# It overwrites the stable branch with the exact contents of unstable. +# No merge is performed — stable becomes identical to unstable (force push). + +on: + workflow_dispatch: + +jobs: + promote: + name: Overwrite stable with unstable + runs-on: ubuntu-latest + + permissions: + contents: write # Required to push to protected/non-protected branches + + steps: + - name: Checkout repository with full history + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history so all branches are available + + - name: Fetch both branches + run: | + git fetch origin unstable stable + + - name: Verify unstable branch exists + run: | + if ! git rev-parse --verify origin/unstable > /dev/null 2>&1; then + echo "ERROR: Branch 'unstable' does not exist on origin. Aborting." + exit 1 + fi + echo "Branch 'unstable' confirmed." + + - name: Verify stable branch exists + run: | + if ! git rev-parse --verify origin/stable > /dev/null 2>&1; then + echo "ERROR: Branch 'stable' does not exist on origin. Aborting." + exit 1 + fi + echo "Branch 'stable' confirmed." + + - name: Show current commit hashes before update + run: | + UNSTABLE_COMMIT=$(git rev-parse origin/unstable) + STABLE_COMMIT=$(git rev-parse origin/stable) + echo "Current unstable commit : $UNSTABLE_COMMIT" + echo "Current stable commit : $STABLE_COMMIT" + echo "UNSTABLE_COMMIT=$UNSTABLE_COMMIT" >> "$GITHUB_ENV" + echo "STABLE_BEFORE=$STABLE_COMMIT" >> "$GITHUB_ENV" + + - name: Check out stable locally + run: | + git checkout stable + + - name: Reset stable to match unstable exactly + # This is NOT a merge. We hard-reset stable to the same commit as unstable. + # After this step, stable and unstable are byte-for-byte identical. + run: | + git reset --hard origin/unstable + + - name: Force push stable to origin + # --force is intentional: we are deliberately replacing stable with unstable. + # GITHUB_TOKEN is sufficient for repositories where the actor has write access. + run: | + git push origin stable --force + + - name: Show stable commit after update + run: | + git fetch origin stable + STABLE_AFTER=$(git rev-parse origin/stable) + echo "-------------------------------------------" + echo "Promotion summary" + echo "-------------------------------------------" + echo "unstable commit : $UNSTABLE_COMMIT" + echo "stable commit (before) : $STABLE_BEFORE" + echo "stable commit (after) : $STABLE_AFTER" + echo "-------------------------------------------" + if [ "$STABLE_AFTER" = "$UNSTABLE_COMMIT" ]; then + echo "SUCCESS: stable now matches unstable." + else + echo "WARNING: stable commit does not match expected unstable commit." + exit 1 + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}