mirror of
https://github.com/actions/checkout.git
synced 2025-10-23 01:41:58 +03:00
change: remove path.sep, add unit tests, dist
Remove path.sep during comparison with repositoryPath (did not take in account root folders) Updated and added more unit tests Updated dist/index.js
This commit is contained in:
parent
faa95350fe
commit
53a4183dea
4 changed files with 26 additions and 6 deletions
6
dist/index.js
vendored
6
dist/index.js
vendored
|
@ -1672,7 +1672,7 @@ function getInputs() {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const result = {};
|
||||
// Working directory
|
||||
let workingDirectory = core.getInput('workingDirectory') || process.env['GITHUB_WORKSPACE'];
|
||||
let workingDirectory = core.getInput('working-directory') || process.env['GITHUB_WORKSPACE'];
|
||||
if (!workingDirectory) {
|
||||
throw new Error('working dir not defined');
|
||||
}
|
||||
|
@ -1694,8 +1694,8 @@ function getInputs() {
|
|||
// Repository path
|
||||
result.repositoryPath = core.getInput('path') || '.';
|
||||
result.repositoryPath = path.resolve(workingDirectory, result.repositoryPath);
|
||||
if (!(result.repositoryPath + path.sep).startsWith(workingDirectory + path.sep)) {
|
||||
throw new Error(`Repository path '${result.repositoryPath}' is not under '${workingDirectory}'`);
|
||||
if (!(result.repositoryPath + path.sep).startsWith(workingDirectory)) {
|
||||
throw new Error(`Repository path '${result.repositoryPath + path.sep}' is not under '${workingDirectory}'`);
|
||||
}
|
||||
// Workflow repository?
|
||||
const isWorkflowRepository = qualifiedRepository.toUpperCase() ===
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue