mirror of
https://github.com/Borales/actions-yarn.git
synced 2026-06-25 18:09:27 +08:00
Updating cwd
This commit is contained in:
+3
-2
@@ -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
@@ -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
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user