Skip to content

Commit a7dcc9f

Browse files
authored
Update sync-main.yml
1 parent 3d57ea9 commit a7dcc9f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/sync-main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,18 @@ jobs:
2929
run: |
3030
git config user.name "github-actions[bot]"
3131
git config user.email "github-actions[bot]@users.noreply.github.com"
32-
git checkout -B auto/sync-main-pr origin/auto/sync-main-pr
32+
- name: Git checkout auto/sync-main-pr
33+
shell: bash
34+
run: |
35+
git fetch origin
36+
if git ls-remote --exit-code --heads origin auto/sync-main-pr > /dev/null; then
37+
echo "Branch exists remotely. Checking it out."
38+
git checkout -B auto/sync-main-pr origin/auto/sync-main-pr
39+
else
40+
echo "Branch does not exist remotely. Creating from main."
41+
git checkout -B auto/sync-main-pr origin/main
42+
git push -u origin auto/sync-main-pr
43+
fi
3344
- name: Sync origin/main
3445
shell: bash
3546
run: |

0 commit comments

Comments
 (0)