Skip to content

Commit 099405b

Browse files
authored
Update sync.yml
1 parent a1e1e40 commit 099405b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/sync.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ jobs:
2121
2222
- name: Switch to jupyterbook branch
2323
run: |
24-
if git rev-parse --verify origin/jupyterbook; then
24+
if git ls-remote --exit-code --heads origin jupyterbook; then
2525
git checkout jupyterbook
2626
else
2727
echo "Branch 'jupyterbook' does not exist. Creating it..."
2828
git checkout -b jupyterbook
29+
git push -u origin jupyterbook
2930
fi
3031
32+
- name: Ensure clean branch state
33+
run: |
34+
git reset --hard origin/jupyterbook
35+
git clean -fd
36+
3137
- name: Sync files from main branch
3238
run: |
3339
git checkout main -- data figures notebooks
@@ -84,4 +90,4 @@ jobs:
8490
run: |
8591
git add _toc.yml
8692
git commit -m "Sync files and update _toc.yml" || echo "No changes to commit"
87-
git push origin jupyterbook
93+
git push origin jupyterbook || git push origin jupyterbook --force

0 commit comments

Comments
 (0)