Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(ci): delete remote release branch first for idempotent reruns

EtienneLescotc5e21579b92a
diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml
index cbb83a1f5..4ae6c7372 100644
--- a/.github/workflows/prerelease.yml
+++ b/.github/workflows/prerelease.yml
@@ -94,6 +94,8 @@ jobs:
# The main-protection ruleset forbids direct pushes to main from workflow tokens.
# Push to a release branch and merge via PR instead (merge via PAT bypasses as EtienneLescot).
BRANCH="release/v${PRERELEASE}"
+ # Delete remote branch first so the push below is always fast-forward (idempotent on rerun).
+ git push "https://x-access-token:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ":${BRANCH}" 2>/dev/null || true
git checkout -b "$BRANCH"
git add package.json
git commit -m "chore(release): bump to ${PRERELEASE} [skip ci]"
diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml
index 4aed6c42f..277b2c590 100644
--- a/.github/workflows/promote.yml
+++ b/.github/workflows/promote.yml
@@ -77,6 +77,8 @@ jobs:
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Push to a release branch and merge via PR (rebase) so the ruleset PR review rule is respected.
BRANCH="release/v${STABLE_VERSION}"
+ # Delete remote branch first so the push below is always fast-forward (idempotent on rerun).
+ git push "https://x-access-token:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ":${BRANCH}" 2>/dev/null || true
git checkout -b "$BRANCH"
git add package.json
git commit -m "chore(release): bump to ${STABLE_VERSION} [skip ci]"