From c334a921c000b578c710d3d83ca696a37a1488bb Mon Sep 17 00:00:00 2001 From: foxundermoon Date: Fri, 17 Jan 2020 23:52:00 +0800 Subject: [PATCH] feature: add working dir input (#17) * feature: add working dir input * docs: add readme doc --- README.md | 13 +++++++++++++ action.yml | 3 +++ index.js | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 3f8ceb7..2bd4702 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,16 @@ jobs: zeit-team-id: team_XXXXXXXXXXX now-args: '--prod' ``` + + +## specific working-directory + +```yml +- uses: amondnet/now-deployment@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + zeit-token: ${{ secrets.ZEIT_TOKEN }} + zeit-team-id: team_XXXXXXXXXXX + now-args: '--prod' + working-directory: ./sub-directory +``` \ No newline at end of file diff --git a/action.yml b/action.yml index d457bd4..278be60 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,9 @@ inputs: required: false default: 'false' description: 'if you want to create github deployment, set true, default: false' + working-directory: + required: false + description: the working directory outputs: diff --git a/index.js b/index.js index 72f8443..4d616f5 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,7 @@ const zeitTeamId = core.getInput('zeit-team-id') const nowArgs = core.getInput('now-args') const githubToken = core.getInput('github-token') const githubDeployment = core.getInput('github-deployment') +const workingDirectory = core.getInput('working-directory') const zeitAPIClient = axios.create({ baseURL: 'https://api.zeit.co', headers: { @@ -49,6 +50,9 @@ async function nowDeploy () { core.info(data.toString()) }, } + if(workingDirectory){ + options.cwd = workingDirectory + } return await exec.exec('npx', [ 'now',