-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Fix race condition when benchmark and tokei-metrics workflows run in parallel.
Problem
When code changes are pushed to main, both workflows trigger simultaneously:
- benchmark.yml (triggers on src/, benches/, Cargo.toml)
- tokei-metrics.yml (triggers on src/, tests/, benches/**, etc.)
Both workflows:
- Checkout main
- Update README.md
- Commit and push
If they run in parallel, one will fail with:
! [rejected] main -> main (fetch first)
error: failed to push some refs
Example
Workflow run failed: https://github.com/RAprogramm/cstring-array/actions/runs/18625288263
Solution
Add git pull --rebase origin main before git push in both workflows:
benchmark.yml:179
git commit -m "chore: update benchmark results [skip ci]"
git pull --rebase origin main # ← ADD
git pushtokei-metrics.yml:159
git commit -m "chore: update tokei metrics [skip ci]"
git pull --rebase origin main # ← ADD
git pushThis ensures both workflows can merge their changes even when running in parallel.
Benefits
- No more failed workflow runs
- Both metrics update successfully
- Race-safe parallel execution
Metadata
Metadata
Assignees
Labels
No labels