fix(workdir): handle trailing slash in working directory path
This commit is contained in:
8
dist/index.js
generated
vendored
8
dist/index.js
generated
vendored
@@ -34545,10 +34545,14 @@ async function run() {
|
||||
// move to working directory
|
||||
const workingDirectory = coreExports.getInput('working_directory');
|
||||
if (workingDirectory) {
|
||||
if (!isValid(workingDirectory)) {
|
||||
// Remove trailing slash if present
|
||||
const normalizedWorkingDirectory = workingDirectory.endsWith('/')
|
||||
? workingDirectory.slice(0, -1)
|
||||
: workingDirectory;
|
||||
if (!isValid(normalizedWorkingDirectory)) {
|
||||
throw new Error('Invalid input: working_directory');
|
||||
}
|
||||
process.chdir(workingDirectory);
|
||||
process.chdir(normalizedWorkingDirectory);
|
||||
}
|
||||
coreExports.info(`Current working directory: ${process.cwd()}`);
|
||||
// get audit-level
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -12,10 +12,15 @@ export async function run(): Promise<void> {
|
||||
// move to working directory
|
||||
const workingDirectory = core.getInput('working_directory')
|
||||
if (workingDirectory) {
|
||||
if (!workdir.isValid(workingDirectory)) {
|
||||
// Remove trailing slash if present
|
||||
const normalizedWorkingDirectory = workingDirectory.endsWith('/')
|
||||
? workingDirectory.slice(0, -1)
|
||||
: workingDirectory
|
||||
|
||||
if (!workdir.isValid(normalizedWorkingDirectory)) {
|
||||
throw new Error('Invalid input: working_directory')
|
||||
}
|
||||
process.chdir(workingDirectory)
|
||||
process.chdir(normalizedWorkingDirectory)
|
||||
}
|
||||
core.info(`Current working directory: ${process.cwd()}`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user