1
0
mirror of https://github.com/actions/checkout.git synced 2026-03-10 09:01:44 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Xavier Solé Nogués
bc654e3205
Merge d1d381abe7 into 8edcb1bdb4 2025-07-25 17:31:56 -04:00
Tingluo Huang
8edcb1bdb4
Update CODEOWNERS for actions (#2224) 2025-07-23 09:20:20 -04:00
xavisolesoft
d1d381abe7 Implement allow-path-outside-workspace 2024-12-18 10:08:23 +01:00
5 changed files with 12 additions and 2 deletions

View File

@ -1 +1 @@
* @actions/actions-launch
* @actions/actions-runtime

View File

@ -92,6 +92,10 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
# Relative path under $GITHUB_WORKSPACE to place the repository
path: ''
# Allow the checked-out repository to be placed outside of the workspace
# Default: false
allow-path-outside-workspace: ''
# Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching
# Default: true
clean: ''

View File

@ -54,6 +54,10 @@ inputs:
default: true
path:
description: 'Relative path under $GITHUB_WORKSPACE to place the repository'
allow-path-outside-workspace:
description: Allow the checked-out repository to be placed outside of the workspace.
default: false
required: false
clean:
description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching'
default: true

3
dist/index.js vendored
View File

@ -1737,7 +1737,8 @@ function getInputs() {
// Repository path
result.repositoryPath = core.getInput('path') || '.';
result.repositoryPath = path.resolve(githubWorkspacePath, result.repositoryPath);
if (!(result.repositoryPath + path.sep).startsWith(githubWorkspacePath + path.sep)) {
if (!core.getInput('allow-path-outside-workspace') &&
!(result.repositoryPath + path.sep).startsWith(githubWorkspacePath + path.sep)) {
throw new Error(`Repository path '${result.repositoryPath}' is not under '${githubWorkspacePath}'`);
}
// Workflow repository?

View File

@ -42,6 +42,7 @@ export async function getInputs(): Promise<IGitSourceSettings> {
result.repositoryPath
)
if (
!core.getInput('allow-path-outside-workspace') &&
!(result.repositoryPath + path.sep).startsWith(
githubWorkspacePath + path.sep
)