From edb45c76ac78844c0daef0d81a24679d1993b3ea Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sat, 14 Nov 2020 09:50:33 +0300 Subject: [PATCH] Don't enforce that checkout path must be inside of Github Workspace Fixes #327, Fixes #197. And i also hit this. --- README.md | 2 +- action.yml | 2 +- dist/index.js | 3 --- src/input-helper.ts | 9 --------- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9c56a6f..a76fc90 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous # Default: true persist-credentials: '' - # Relative path under $GITHUB_WORKSPACE to place the repository + # Path relative to $GITHUB_WORKSPACE to place the repository path: '' # Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching diff --git a/action.yml b/action.yml index 91d3982..47a4423 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ inputs: description: 'Whether to configure the token or SSH key with the local git config' default: true path: - description: 'Relative path under $GITHUB_WORKSPACE to place the repository' + description: 'Path relative to $GITHUB_WORKSPACE to place the repository' clean: description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching' default: true diff --git a/dist/index.js b/dist/index.js index e765cc2..c02508e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14537,9 +14537,6 @@ 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)) { - throw new Error(`Repository path '${result.repositoryPath}' is not under '${githubWorkspacePath}'`); - } // Workflow repository? const isWorkflowRepository = qualifiedRepository.toUpperCase() === `${github.context.repo.owner}/${github.context.repo.repo}`.toUpperCase(); diff --git a/src/input-helper.ts b/src/input-helper.ts index 4c05d6e..65b8614 100644 --- a/src/input-helper.ts +++ b/src/input-helper.ts @@ -40,15 +40,6 @@ export function getInputs(): IGitSourceSettings { githubWorkspacePath, result.repositoryPath ) - if ( - !(result.repositoryPath + path.sep).startsWith( - githubWorkspacePath + path.sep - ) - ) { - throw new Error( - `Repository path '${result.repositoryPath}' is not under '${githubWorkspacePath}'` - ) - } // Workflow repository? const isWorkflowRepository =