fix(workdir): handle trailing slash in working directory path
This commit is contained in:
@@ -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