Compare commits

..

6 Commits

Author SHA1 Message Date
eric sciple 75317902be
Merge 2bcd7c6585 into ff7abcd0c3 2025-10-15 10:38:35 -05:00
eric sciple 2bcd7c6585 . 2025-10-15 15:38:31 +00:00
eric sciple 857facff5c . 2025-10-15 15:36:09 +00:00
eric sciple ff9f98e487 . 2025-10-15 15:20:00 +00:00
eric sciple aa7e6581cb . 2025-10-15 14:13:56 +00:00
eric sciple 6397f22a4f . 2025-10-15 14:09:45 +00:00
5 changed files with 22 additions and 26 deletions

View File

@ -299,15 +299,18 @@ jobs:
test-output:
runs-on: ubuntu-latest
steps:
# Clone this repo
# Download the action at the current ref
- name: Checkout
uses: actions/checkout@v4.1.6
with:
path: actions-checkout
# Basic checkout using git
- name: Checkout basic
id: checkout
uses: ./
uses: ./actions-checkout
with:
path: cloned-using-local-action
ref: test-data/v2/basic
# Verify output
@ -325,7 +328,3 @@ jobs:
echo "Expected commit to be 82f71901cf8c021332310dcc8cdba84c4193ff5d"
exit 1
fi
# needed to make checkout post cleanup succeed
- name: Fix Checkout
uses: actions/checkout@v4.1.6

View File

@ -17,7 +17,7 @@ fi
echo "Testing persisted credential"
pushd ./submodules-recursive/submodule-level-1/submodule-level-2
git config --local --name-only --get-regexp http.+extraheader && git fetch
git config --local --name-only --get-regexp '^includeIf\.' && git fetch
if [ "$?" != "0" ]; then
echo "Failed to validate persisted credential"
popd

View File

@ -17,7 +17,7 @@ fi
echo "Testing persisted credential"
pushd ./submodules-true/submodule-level-1
git config --local --name-only --get-regexp http.+extraheader && git fetch
git config --local --name-only --get-regexp '^includeIf\.' && git fetch
if [ "$?" != "0" ]; then
echo "Failed to validate persisted credential"
popd

14
dist/index.js vendored
View File

@ -289,15 +289,15 @@ class GitAuthHelper {
// For each submodule, configure includeIf entries pointing to the shared credentials file.
// Configure both host and container paths to support Docker container actions.
for (const configPath of configPaths) {
// The config file is at .git/modules/submodule-name/config
let submoduleConfigDir = path.dirname(configPath);
submoduleConfigDir = submoduleConfigDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
// Submodule Git directory
let submoduleGitDir = path.dirname(configPath); // The config file is at .git/modules/submodule-name/config
submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
// Configure host includeIf
yield this.git.config(`includeIf.gitdir:${submoduleConfigDir}.path`, credentialsConfigPath, false, false, configPath);
yield this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, false, configPath);
// Configure container includeIf
let relativeSubmoduleConfigDir = path.relative(githubWorkspace, submoduleConfigDir);
relativeSubmoduleConfigDir = relativeSubmoduleConfigDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
const containerSubmoduleGitDir = path.posix.join('/github/workspace', relativeSubmoduleConfigDir);
let relativeSubmoduleGitDir = path.relative(githubWorkspace, submoduleGitDir);
relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
const containerSubmoduleGitDir = path.posix.join('/github/workspace', relativeSubmoduleGitDir);
yield this.git.config(`includeIf.gitdir:${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, false, configPath);
}
if (this.settings.sshKey) {

View File

@ -205,13 +205,13 @@ class GitAuthHelper {
// For each submodule, configure includeIf entries pointing to the shared credentials file.
// Configure both host and container paths to support Docker container actions.
for (const configPath of configPaths) {
// The config file is at .git/modules/submodule-name/config
let submoduleConfigDir = path.dirname(configPath)
submoduleConfigDir = submoduleConfigDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
// Submodule Git directory
let submoduleGitDir = path.dirname(configPath) // The config file is at .git/modules/submodule-name/config
submoduleGitDir = submoduleGitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
// Configure host includeIf
await this.git.config(
`includeIf.gitdir:${submoduleConfigDir}.path`,
`includeIf.gitdir:${submoduleGitDir}.path`,
credentialsConfigPath,
false,
false,
@ -219,17 +219,14 @@ class GitAuthHelper {
)
// Configure container includeIf
let relativeSubmoduleConfigDir = path.relative(
let relativeSubmoduleGitDir = path.relative(
githubWorkspace,
submoduleConfigDir
submoduleGitDir
)
relativeSubmoduleConfigDir = relativeSubmoduleConfigDir.replace(
/\\/g,
'/'
) // Use forward slashes, even on Windows
relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
const containerSubmoduleGitDir = path.posix.join(
'/github/workspace',
relativeSubmoduleConfigDir
relativeSubmoduleGitDir
)
await this.git.config(
`includeIf.gitdir:${containerSubmoduleGitDir}.path`,