Compare commits

...

4 Commits

Author SHA1 Message Date
Marcus Wirtz 639ecdce9a
Merge b23eb344e8 into f548e57e54 2026-07-20 23:41:05 +01:00
Aiqiao Yan f548e57e54
Consolidate dependency updates in CHANGELOG (#2537)
* Consolidate dependency updates in CHANGELOG

Removed specific dependency updates and consolidated them into a single entry.

* Fix capitalization in v7.0.1 changelog entries

Updated changelog entries for v7.0.1 to use consistent capitalization.
2026-07-20 12:20:47 -04:00
Marcus Wirtz b23eb344e8
Fix stuff 2026-04-21 12:30:04 +02:00
Marcus Wirtz a0eb51f8ea
fix: fix adding safe-directory in container 2026-04-21 11:32:17 +02:00
6 changed files with 55 additions and 46 deletions

View File

@ -314,7 +314,6 @@ jobs:
fi
# Verify auth token
git config --global --add safe.directory "*"
git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main
# needed to make checkout post cleanup succeed

View File

@ -1,26 +1,14 @@
# Changelog
## v7.0.1
* Bump github/codeql-action from 3 to 4 by @dependabot[bot] in https://github.com/actions/checkout/pull/2475
* Bump actions/setup-node from 4 to 6 by @dependabot[bot] in https://github.com/actions/checkout/pull/2477
* Bump docker/build-push-action from 6.5.0 to 7.2.0 by @dependabot[bot] in https://github.com/actions/checkout/pull/2478
* Bump docker/login-action from 3.3.0 to 4.2.0 by @dependabot[bot] in https://github.com/actions/checkout/pull/2479
* Bump actions/checkout from 6 to 7 by @dependabot[bot] in https://github.com/actions/checkout/pull/2488
* Bump actions/upload-artifact from 4 to 7 by @dependabot[bot] in https://github.com/actions/checkout/pull/2476
* eslint 9 by @dependabot[bot] in https://github.com/actions/checkout/pull/2474
* Bump the minor-actions-dependencies group with 2 updates by @dependabot[bot] in https://github.com/actions/checkout/pull/2499
* skip running unsafe pr check if input is default by @aiqiaoy in https://github.com/actions/checkout/pull/2518
* trim only ascii whitespace for branch by @aiqiaoy in https://github.com/actions/checkout/pull/2521
* escape values passed to --unset by @aiqiaoy in https://github.com/actions/checkout/pull/2530
* Skip running unsafe pr check if input is default by @aiqiaoy in https://github.com/actions/checkout/pull/2518
* Trim only ascii whitespace for branch by @aiqiaoy in https://github.com/actions/checkout/pull/2521
* Escape values passed to --unset by @aiqiaoy in https://github.com/actions/checkout/pull/2530
* Various dependency updates
## v7.0.0
* Block checking out fork PR for pull_request_target and workflow_run by @aiqiaoy in https://github.com/actions/checkout/pull/2454
* Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 in the minor-actions-dependencies group across 1 directory by @dependabot[bot] in https://github.com/actions/checkout/pull/2458
* Bump flatted from 3.3.1 to 3.4.2 by @dependabot[bot] in https://github.com/actions/checkout/pull/2460
* Bump js-yaml from 4.1.0 to 4.2.0 by @dependabot[bot] in https://github.com/actions/checkout/pull/2461
* Bump @actions/core and @actions/tool-cache and Remove uuid by @dependabot[bot] in https://github.com/actions/checkout/pull/2459
* upgrade module to esm and update dependencies by @aiqiaoy in https://github.com/actions/checkout/pull/2463
* Bump the minor-npm-dependencies group across 1 directory with 3 updates by @dependabot[bot] in https://github.com/actions/checkout/pull/2462
* Various dependency updates
## v6.0.3
* Fix checkout init for SHA-256 repositories by @yaananth in https://github.com/actions/checkout/pull/2439

View File

@ -15,9 +15,6 @@ fi
cd "$CHECKOUT_PATH"
# Add safe directory for container environments
git config --global --add safe.directory "*" 2>/dev/null || true
# Show the includeIf configuration
echo "Git config includeIf entries:"
git config --list --show-origin | grep -i include || true

View File

@ -44,20 +44,14 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
if (git) {
authHelper = gitAuthHelper.createAuthHelper(git, settings)
if (settings.setSafeDirectory) {
// Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail
// Otherwise all git commands we run in a container fail
await authHelper.configureTempGlobalConfig()
core.info(
`Adding repository directory to the temporary git global config as a safe directory`
await addSafeDirectory(settings.repositoryPath, git, authHelper)
const containerPath = getContainerRepositoryPath(
settings.repositoryPath,
settings.githubWorkspacePath
)
await git
.config('safe.directory', settings.repositoryPath, true, true)
.catch(error => {
core.info(
`Failed to initialize safe directory with error: ${error}`
)
})
if (containerPath && containerPath !== settings.repositoryPath) {
await addSafeDirectory(containerPath, git, authHelper)
}
stateHelper.setSafeDirectory()
}
@ -350,18 +344,7 @@ export async function cleanup(repositoryPath: string): Promise<void> {
const authHelper = gitAuthHelper.createAuthHelper(git)
try {
if (stateHelper.PostSetSafeDirectory) {
// Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail
// Otherwise all git commands we run in a container fail
await authHelper.configureTempGlobalConfig()
core.info(
`Adding repository directory to the temporary git global config as a safe directory`
)
await git
.config('safe.directory', repositoryPath, true, true)
.catch(error => {
core.info(`Failed to initialize safe directory with error: ${error}`)
})
await addSafeDirectory(repositoryPath, git, authHelper)
}
await authHelper.removeAuth()
@ -390,3 +373,39 @@ async function getGitCommandManager(
return undefined
}
}
async function addSafeDirectory(
safeDirectory: string,
git: IGitCommandManager,
authHelper: gitAuthHelper.IGitAuthHelper
): Promise<void> {
await authHelper.configureTempGlobalConfig()
core.info(`Adding '${safeDirectory}' to the git global config as a safe directory`)
await git.config('safe.directory', safeDirectory, true, true).catch(error => {
core.info(`Failed to initialize safe directory with error: ${error}`)
})
}
function getContainerRepositoryPath(
repositoryPath: string,
githubWorkspace?: string
): string {
if (!githubWorkspace) {
return ''
}
let relativeRepositoryPath = path.relative(githubWorkspace, repositoryPath)
if (!relativeRepositoryPath || relativeRepositoryPath === '.') {
return '/github/workspace'
}
if (
relativeRepositoryPath.startsWith('..') ||
path.isAbsolute(relativeRepositoryPath)
) {
return ''
}
relativeRepositoryPath = relativeRepositoryPath.replace(/\\/g, '/')
return path.posix.join('/github/workspace', relativeRepositoryPath)
}

View File

@ -1,4 +1,9 @@
export interface IGitSourceSettings {
/**
* The workflow workspace path
*/
githubWorkspacePath?: string
/**
* The location on disk where the repository will be placed
*/

View File

@ -15,6 +15,7 @@ export async function getInputs(): Promise<IGitSourceSettings> {
throw new Error('GITHUB_WORKSPACE not defined')
}
githubWorkspacePath = path.resolve(githubWorkspacePath)
result.githubWorkspacePath = githubWorkspacePath
core.debug(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`)
fsHelper.directoryExistsSync(githubWorkspacePath, true)