This commit is contained in:
Scott Driggers 2023-01-16 11:29:55 +01:00 committed by GitHub
commit 475907437c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

13
dist/index.js vendored
View file

@ -7129,8 +7129,17 @@ class GitAuthHelper {
}
}
if (configExists) {
core.info(`Copying '${gitConfigPath}' to '${newGitConfigPath}'`);
yield io.cp(gitConfigPath, newGitConfigPath);
if ((yield fs.promises.lstat(gitConfigPath)).isSymbolicLink()) {
core.info(`.gitconfig file at ${gitConfigPath} is a symlink, copying the true file instead`);
// get true link
const symlinkFull = yield fs.promises.readlink(gitConfigPath);
core.info(`Copying '${symlinkFull}' to '${newGitConfigPath}'`);
yield io.cp(symlinkFull, newGitConfigPath);
}
else {
core.info(`Copying '${gitConfigPath}' to '${newGitConfigPath}'`);
yield io.cp(gitConfigPath, newGitConfigPath);
}
}
else {
yield fs.promises.writeFile(newGitConfigPath, '');