Remove git submodules before git checkout (#1611)

If a git submodule is converted to a regular git directory (e.g. when
moving from dev -> rel-6 branch), the directory is not properly cleaned
by the checkout action.

Remove the git submodule .git files which makes sure that git properly
reinitialize subdirectories, even if they have been a submodule before.

See also: https://github.com/actions/checkout/issues/624
This commit is contained in:
Stefan Agner 2021-10-27 11:02:24 +02:00 committed by GitHub
parent e83e6f4712
commit ff07728fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -77,6 +77,10 @@ jobs:
return { "ref": context.ref } return { "ref": context.ref }
return { "ref": context.payload.pull_request.head.sha } return { "ref": context.payload.pull_request.head.sha }
# Make sure directories of potentially removed submodules are cleaned correctly
- name: Cleanup git submodules
run: find . -name .git -type f -exec rm {} \;
- name: Checkout source - name: Checkout source
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:

View File

@ -59,6 +59,10 @@ jobs:
runs-on: ${{ matrix.board.runner }} runs-on: ${{ matrix.board.runner }}
steps: steps:
# Make sure directories of potentially removed submodules are cleaned correctly
- name: Cleanup git submodules
run: find . -name .git -type f -exec rm {} \;
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with: