Compare commits

...

6 commits

Author SHA1 Message Date
Kaido Kert
5a1964cd65
Merge 1bf7689f6b into cbb722410c 2024-11-14 10:45:18 -05:00
Kaido Kert
1bf7689f6b Update dist/index.js with changes 2023-05-15 13:31:08 -07:00
Cosimo Streppone
b9935aab1f Tried to fix the "unstaged changes" test failure
Error: Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run format && npm run build
Error: Process completed with exit code 1.

Rebased PR from #424
2023-05-15 12:26:26 -07:00
Cosimo Streppone
fbc745150c Revert "GH#354 Updated dist/index.js build"
This reverts commit c764e5eab9.
2023-05-15 12:25:28 -07:00
Cosimo Streppone
27cd406012 GH#354 Updated dist/index.js build 2023-05-15 12:25:25 -07:00
Cosimo Streppone
55709ffa1b GH#354 Disabled auth submodules config when related setting is false
This should help with https://github.com/actions/checkout/issues/354.
The problem is that I have no idea whether such auth submodules configuration
is required even when settings.submodules is false.
2023-05-15 12:23:41 -07:00
3 changed files with 18 additions and 10 deletions

View file

@ -482,6 +482,7 @@ describe('git-auth-helper tests', () => {
)
settings.persistCredentials = false
settings.sshKey = ''
settings.submodules = true
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
@ -515,6 +516,7 @@ describe('git-auth-helper tests', () => {
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsFalseAndSshKeySet
)
settings.persistCredentials = false
settings.submodules = true
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
@ -541,6 +543,7 @@ describe('git-auth-helper tests', () => {
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeyNotSet
)
settings.sshKey = ''
settings.submodules = true
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>
@ -580,6 +583,7 @@ describe('git-auth-helper tests', () => {
await setup(
configureSubmoduleAuth_configuresSubmodulesWhenPersistCredentialsTrueAndSshKeySet
)
settings.submodules = true
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
await authHelper.configureAuth()
const mockSubmoduleForeach = git.submoduleForeach as jest.Mock<any, any>

2
dist/index.js vendored
View file

@ -424,10 +424,12 @@ class GitAuthHelper {
core.warning(`Failed to remove '${configKey}' from the git config`);
}
}
if (this.settings.submodules) {
const pattern = regexpHelper.escape(configKey);
yield this.git.submoduleForeach(
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
}
});
}
}

View file

@ -364,6 +364,7 @@ class GitAuthHelper {
}
}
if (this.settings.submodules) {
const pattern = regexpHelper.escape(configKey)
await this.git.submoduleForeach(
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
@ -372,3 +373,4 @@ class GitAuthHelper {
)
}
}
}