1
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2026-05-06 18:07:35 +02:00
This commit is contained in:
Drew Ballance 2026-05-05 08:41:56 +02:00 committed by GitHub
commit 25305e04d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 111 additions and 6 deletions

16
dist/index.js vendored
View file

@ -406,9 +406,19 @@ class GitAuthHelper {
);
}
else {
// Host git directory
let gitDir = path.join(this.git.getWorkingDirectory(), '.git');
gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
// Host git directory - resolve symlinks so includeIf gitdir matching works
// on self-hosted runners where _work is a symlink to an external volume.
let gitDir;
try {
const constructed = path.join(this.git.getWorkingDirectory(), '.git');
const resolved = yield fs.promises.realpath(constructed);
gitDir = resolved.replace(/\\/g, '/');
}
catch (_a) {
// Fall back to constructed path if realpath fails
gitDir = path.join(this.git.getWorkingDirectory(), '.git');
gitDir = gitDir.replace(/\\/g, '/');
}
// Configure host includeIf
const hostIncludeKey = `includeIf.gitdir:${gitDir}.path`;
yield this.git.config(hostIncludeKey, credentialsConfigPath);