ci: fix restore-mtime exit code when last file is deleted on macos runners#6268
ci: fix restore-mtime exit code when last file is deleted on macos runners#6268desmondcheongzx merged 3 commits intomainfrom
Conversation
GitHub Actions shell: bash runs with set -eo pipefail. The previous [ -f ] && touch_epoch pattern returns exit code 1 when the test fails (file doesn't exist), and if this happens on the last iteration of the while loop, pipefail propagates that exit code and kills the step. Switch to if/then/fi so a non-existent file is a no-op with exit code 0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR fixes a critical CI issue where the restore-mtime action was failing on macOS runners when the last file processed in the loop was deleted in a later commit. The root cause is that GitHub Actions runs bash scripts with The fix replaces the shorthand
This is a correct and safe fix that maintains the same logical behavior while preventing spurious CI failures. Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 7f096bb |
Add a lightweight job that runs restore-mtime on both Linux and macOS, then verifies that file mtimes are actually restored to pre-checkout timestamps. This confirms the BSD touch fallback and the pipefail fix work correctly on both platforms. TODO: Remove this job once verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both Linux and macOS passed the smoke test. Remove the temporary job. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6268 +/- ##
==========================================
- Coverage 73.44% 73.44% -0.01%
==========================================
Files 1003 1003
Lines 133436 133156 -280
==========================================
- Hits 98005 97794 -211
+ Misses 35431 35362 -69 🚀 New features to boost your workflow:
|
…nners (Eventual-Inc#6268) GitHub Actions `shell: bash` runs with `set -eo pipefail`. The `[ -f "$file" ] && touch_epoch` pattern returns exit code 1 when the file doesn't exist on disk (deleted in a later commit), and if this happens on the last iteration of the while loop, `pipefail` propagates that exit code and kills the step. Switch to `if/then/fi` so a non-existent file is a no-op with exit code 0. Verified with a temporary smoke-test job on both `ubuntu-latest` (11s) and `macos-latest` (54s) that confirmed mtimes are correctly restored on both platforms. Fixes the restore-mtime failures seen on macOS runners in Eventual-Inc#6264. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
GitHub Actions
shell: bashruns withset -eo pipefail. The[ -f "$file" ] && touch_epochpattern returns exit code 1 when the file doesn't exist on disk (deleted in a later commit), and if this happens on the last iteration of the while loop,pipefailpropagates that exit code and kills the step.Switch to
if/then/fiso a non-existent file is a no-op with exit code 0.Verified with a temporary smoke-test job on both
ubuntu-latest(11s) andmacos-latest(54s) that confirmed mtimes are correctly restored on both platforms.Fixes the restore-mtime failures seen on macOS runners in #6264.