From f0a5b900407c445fd09a3dfed6dceeae50dc6aa9 Mon Sep 17 00:00:00 2001 From: "A. Ryan Lawson" Date: Fri, 17 May 2024 20:25:34 -0400 Subject: [PATCH] Allow user to change working directory --- README.md | 10 ++++++++++ action.yml | 5 +++++ entrypoint.sh | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 033b393..57f80ab 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,16 @@ jobs: uses: serverless/github-action@v3.2 with: serverless-version: 3 + args: deploy +``` + +## Change your working directory +```yaml + - name: Deploy from a particular working directory + uses: serverless/github-action@v3.2 + with: + working-directory: ./foo + args: deploy ``` ## Usage with serverless plugins diff --git a/action.yml b/action.yml index dc03f02..7c76ec3 100644 --- a/action.yml +++ b/action.yml @@ -9,9 +9,14 @@ inputs: description: 'Version of the Serverless Framework to use (default: latest)' required: false default: latest + working-directory: + description: 'Folder where your configuration is located' + required: false + default: . runs: using: 'docker' image: 'Dockerfile' args: + - ${{ inputs.working-directory }} - ${{ inputs.serverless-version }} - ${{ inputs.args }} diff --git a/entrypoint.sh b/entrypoint.sh index df9b4ac..1fd2b18 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,4 @@ #!/bin/sh -l -npm i -g serverless@${1/v/} -serverless $2 +cd $1 +npm i -g serverless@${2/v/} +serverless $3