0
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2025-10-23 09:51:56 +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:
Marco Accorinti 2023-09-20 21:02:10 +02:00
parent faa95350fe
commit 53a4183dea
4 changed files with 26 additions and 6 deletions

6
dist/index.js vendored
View file

@ -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() ===