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:
Drew 2025-12-26 21:39:07 +00:00
parent 39af35d15a
commit 26cda0f1ec
1 changed files with 15 additions and 1 deletions

View File

@ -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