Skip to content

Commit 50ba560

Browse files
committed
Fix sync: delete old branch before push + force-push
1 parent 8afb413 commit 50ba560

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/upstream-sync.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
echo "behind=$BEHIND" >> $GITHUB_OUTPUT
3636
echo "$BEHIND new commits from upstream"
3737
38+
- name: Delete old sync branches
39+
if: steps.check.outputs.behind != '0'
40+
run: |
41+
git push origin --delete upstream-sync/$(date +%Y-%m-%d) 2>/dev/null || true
42+
3843
- name: Create sync branch and merge
3944
if: steps.check.outputs.behind != '0'
4045
id: merge
@@ -68,7 +73,7 @@ jobs:
6873
- name: Push sync branch
6974
if: steps.check.outputs.behind != '0'
7075
run: |
71-
git push -u origin "${{ steps.merge.outputs.branch }}"
76+
git push -u origin "${{ steps.merge.outputs.branch }}" --force
7277
7378
- name: Create PR (clean merge)
7479
if: steps.check.outputs.behind != '0' && steps.merge.outputs.clean == 'true'

0 commit comments

Comments
 (0)