Fix workflow race condition with concurrency control and pull-rebase
- Add concurrency group to prevent parallel workflow runs - Pull and rebase before pushing to handle remote changes - Auto-regenerate files if rebase fails to resolve conflicts
This commit is contained in:
parent
39af35d15a
commit
26cda0f1ec
|
|
@ -13,6 +13,10 @@ on:
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 0 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: update-calendar
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-calendar:
|
update-calendar:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -44,6 +48,16 @@ jobs:
|
||||||
git commit -m "Auto-update calendar files
|
git commit -m "Auto-update calendar files
|
||||||
|
|
||||||
🤖 Generated with automation"
|
🤖 Generated with automation"
|
||||||
git pull --rebase origin main
|
# Pull latest changes and rebase our commit on top
|
||||||
|
git pull --rebase origin main || {
|
||||||
|
# If rebase fails, regenerate files to resolve conflicts
|
||||||
|
git rebase --abort
|
||||||
|
git pull origin main
|
||||||
|
python generate_calendar.py
|
||||||
|
git add calendar.ics README.md
|
||||||
|
git commit -m "Auto-update calendar files
|
||||||
|
|
||||||
|
🤖 Generated with automation"
|
||||||
|
}
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue