diff --git a/.github/actions/checkout-pytorch/action.yml b/.github/actions/checkout-pytorch/action.yml index 055404c6947..15f193ef3a5 100644 --- a/.github/actions/checkout-pytorch/action.yml +++ b/.github/actions/checkout-pytorch/action.yml @@ -57,6 +57,21 @@ runs: submodules: ${{ inputs.submodules }} show-progress: false + - name: Clean submodules post checkout + id: clean-submodules + if: ${{ steps.check_container_runner.outputs.IN_CONTAINER_RUNNER == 'false' }} + shell: bash + env: + NO_SUDO: ${{ inputs.no-sudo }} + run: | + cd "${GITHUB_WORKSPACE}" + # Clean stale submodule dirs + if [ -z "${NO_SUDO}" ]; then + sudo git submodule foreach --recursive git clean -ffdx + else + git submodule foreach --recursive git clean -ffdx + fi + - name: Clean workspace (try again) if: ${{ steps.check_container_runner.outputs.IN_CONTAINER_RUNNER == 'false' && (steps.first-clean.outcome != 'success' || steps.first-checkout-attempt.outcome != 'success') }}