mirror of
https://github.com/actions/checkout.git
synced 2026-05-06 18:07:35 +02:00
Merge fbeb4a8af3 into 900f2210b1
This commit is contained in:
commit
25305e04d5
3 changed files with 111 additions and 6 deletions
16
dist/index.js
vendored
16
dist/index.js
vendored
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue