Skip to content

Commit

Permalink
ci: Clean index.lock files
Browse files Browse the repository at this point in the history
Cancelling a job while the checkout step is running often results in
index.lock files persisting in one of the submodules. The checkout action
only removes index.lock files in the root repo, but not in submodules.
(See issue actions/checkout#1153).
On the following job runs, checkout fails, being unable to operate on
a submodule with an index.lock file.

This new step will remove such files when the job was cancelled or
has failed on the checkout step or before it.

For details on the status check functions, used in this step, see
https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions

Resolves #316

Co-authored-by: Mikhail Aksenov <[email protected]>
  • Loading branch information
2 people authored and nkaskov committed Nov 7, 2023
1 parent 2e81fc5 commit 4e7b762
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ jobs:
submodules: 'recursive'
fetch-depth: 0

- name: Clean index.lock files if checkout step was cancelled or failed
if: cancelled() || failure()
run: |
find .git -name 'index.lock' -exec rm -v {} \;
# Workaround: https://github.com/actions/checkout/issues/1169
- name: Mark directory as safe
run: |
Expand Down

0 comments on commit 4e7b762

Please sign in to comment.