From 3fb9e3e2032e7b536bed495c0702d94769af7a2c Mon Sep 17 00:00:00 2001 From: Markus Waldheim Date: Tue, 25 Aug 2026 08:09:56 +0200 Subject: [PATCH] fix: handle concurrent template sync branches Signed-off-by: Markus Waldheim Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/sync-template.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-template.yml b/.github/workflows/sync-template.yml index 54889c5..9046cbd 100644 --- a/.github/workflows/sync-template.yml +++ b/.github/workflows/sync-template.yml @@ -145,7 +145,13 @@ jobs: git checkout -b "$BRANCH" git add -A git commit -m "chore: sync from plugin-template@${SHORT_SHA} -- $CHANGED" - git push origin "$BRANCH" + if ! git push origin "$BRANCH"; then + if git ls-remote --exit-code origin "refs/heads/$BRANCH" > /dev/null 2>&1; then + echo "Branch $BRANCH was created concurrently - skipping PR" + exit 0 + fi + exit 1 + fi TITLE="chore: sync from plugin-template" BODY="Automated sync from SemRels/plugin-template (${SHORT_SHA}). Updated: $CHANGED" gh pr create --repo "SemRels/$PLUGIN" --title "$TITLE" --body "$BODY" --base main || echo "PR may already exist"