Updating cwd

This commit is contained in:
Borales
2022-11-26 22:25:09 +01:00
parent 37ae1f22f9
commit d2ca561aa5
5 changed files with 23 additions and 15 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import {debug, getInput, setOutput, setFailed} from '@actions/core'
import {debug, getInput, setOutput, setFailed, getState} from '@actions/core'
import {ensureYarnIsInstalled} from './yarn'
import {run} from './run'
@@ -6,11 +6,12 @@ const main = async () => {
await ensureYarnIsInstalled()
const cmd: string = getInput('cmd', {required: true})
const cwd: string = getState('repositoryPath')
try {
debug(`Running "${cmd}" command`)
await run(cmd)
await run(cmd, {cwd})
setOutput(cmd, 'Done')
} catch (error) {
if (error instanceof Error) setFailed(error.message)
+2 -2
View File
@@ -1,5 +1,5 @@
import {exec} from '@actions/exec'
export const run = async (cmd: string) => {
await exec('yarn', [cmd])
export const run = async (cmd: string, {cwd}: {cwd: string}) => {
await exec('yarn', [cmd], {cwd})
}
+3 -1
View File
@@ -1,4 +1,4 @@
import {debug} from '@actions/core'
import {debug, setOutput} from '@actions/core'
import {exec, getExecOutput} from '@actions/exec'
import {which} from '@actions/io'
@@ -15,4 +15,6 @@ export const ensureYarnIsInstalled = async () => {
])
debug(`Node ${nodeVersion.trim()} detected`)
debug(`Yarn v${yarnVersion.trim()} detected`)
setOutput('yarn-version', yarnVersion.trim())
}