Skip to content

Commit 95e108d

Browse files
committed
Once the clone and the checkout succeeded, get rid of the bare repository
We start out with a bare, shallow clone of `git-sdk-32`/`git-sdk-64`. This lives in the current directory, as `.tmp/`. Some GitHub workflows are very picky about the current directory and do not want any untracked files flying about. Most notably, Git's own test suite wants to make sure that there are no unexpected files in the work tree after a successful build, and `.tmp` counts for "unexpected" here. Let's remove the bare repository once we no longer need it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 415fa25 commit 95e108d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ jobs:
4242
- name: Verify that the Bash of Git for Windows' SDK is used
4343
shell: bash
4444
run: |
45-
set -x
45+
set -ex
46+
test ! -e .tmp
4647
echo "This is the MSYS2 pseudo root: $(cygpath -aw /)"
4748
test "gcc is /mingw64/bin/gcc" = "$(type gcc)"
4849
test "prove is /usr/bin/core_perl/prove" = "$(type prove)"

src/git.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as core from '@actions/core'
22
import {ChildProcess, spawn} from 'child_process'
33
import {Octokit} from '@octokit/rest'
44
import {delimiter} from 'path'
5+
import * as fs from 'fs'
56

67
const gitForWindowsUsrBinPath = 'C:/Program Files/Git/usr/bin'
78
const gitExePath = 'C:/Program Files/Git/cmd/git.exe'
@@ -160,7 +161,7 @@ export async function getViaGit(
160161
child.on('close', code => {
161162
core.endGroup()
162163
if (code === 0) {
163-
resolve()
164+
fs.rm('.tmp', {recursive: true}, () => resolve())
164165
} else {
165166
reject(new Error(`process exited with code ${code}`))
166167
}

0 commit comments

Comments
 (0)