name: Promote Unstable to Stable # This workflow is MANUAL-ONLY. # It overwrites Panel-stable with the exact contents of Panel-unstable. # No merge is performed — Panel-stable becomes identical to Panel-unstable (force push). on: workflow_dispatch: jobs: promote: name: Overwrite Panel-stable with Panel-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 Panel-unstable and Panel-stable run: | git fetch origin Panel-unstable Panel-stable - name: Verify Panel-unstable branch exists run: | if ! git rev-parse --verify origin/Panel-unstable > /dev/null 2>&1; then echo "ERROR: Branch 'Panel-unstable' does not exist on origin. Aborting." exit 1 fi echo "Branch 'Panel-unstable' confirmed." - name: Verify Panel-stable branch exists run: | if ! git rev-parse --verify origin/Panel-stable > /dev/null 2>&1; then echo "ERROR: Branch 'Panel-stable' does not exist on origin. Aborting." exit 1 fi echo "Branch 'Panel-stable' confirmed." - name: Show commit hashes before update run: | UNSTABLE_COMMIT=$(git rev-parse origin/Panel-unstable) STABLE_COMMIT=$(git rev-parse origin/Panel-stable) echo "Panel-unstable commit : $UNSTABLE_COMMIT" echo "Panel-stable commit (before) : $STABLE_COMMIT" echo "UNSTABLE_COMMIT=$UNSTABLE_COMMIT" >> "$GITHUB_ENV" echo "STABLE_BEFORE=$STABLE_COMMIT" >> "$GITHUB_ENV" - name: Check out Panel-stable locally run: | git checkout -B Panel-stable origin/Panel-stable - name: Reset Panel-stable to match Panel-unstable exactly # This is NOT a merge. We hard-reset Panel-stable to the same commit as Panel-unstable. # After this step, Panel-stable and Panel-unstable are byte-for-byte identical. run: | git reset --hard origin/Panel-unstable - name: Force push Panel-stable to origin # --force is intentional: we are deliberately replacing Panel-stable with Panel-unstable. # GITHUB_TOKEN is sufficient for repositories where the actor has write access. run: | git push origin Panel-stable --force - name: Show Panel-stable commit after update run: | git fetch origin Panel-stable STABLE_AFTER=$(git rev-parse origin/Panel-stable) echo "-------------------------------------------" echo "Promotion summary" echo "-------------------------------------------" echo "Panel-unstable commit : $UNSTABLE_COMMIT" echo "Panel-stable commit (before) : $STABLE_BEFORE" echo "Panel-stable commit (after) : $STABLE_AFTER" echo "-------------------------------------------" if [ "$STABLE_AFTER" = "$UNSTABLE_COMMIT" ]; then echo "SUCCESS: Panel-stable now matches Panel-unstable." else echo "WARNING: Panel-stable commit does not match expected Panel-unstable commit." exit 1 fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}