From b5216273786c9e36274ad9e5281a4c4700f8eba3 Mon Sep 17 00:00:00 2001 From: Brendon Lee Date: Fri, 15 Jan 2021 10:06:03 +0800 Subject: [PATCH 1/2] Add parameter support - Add argument selector to runner-entrypoint - Add args to action.yml - Add example to README.md --- README.md | 2 ++ action.yml | 6 ++++++ runner-entrypoint.sh | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41f63ed..1a3dc3b 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ jobs: - name: 'run pipeline' uses: codefresh-io/codefresh-pipeline-runner@v5 + with: + args: '-v key1=value1 -v key2=value2' env: PIPELINE_NAME: 'codefresh-pipeline' TRIGGER_NAME: 'codefresh-trigger' diff --git a/action.yml b/action.yml index 8eccec6..ba52678 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,15 @@ name: 'Codefresh pipeline runner' description: 'Github action that runs codefresh pipeline' author: 'codefresh-inc' +inputs: + args: + description: 'codefresh cli build variables, see https://codefresh-io.github.io/cli/pipelines/run-pipeline/#setting-variables-through-the-command for more information.' + required: false branding: icon: 'arrow-right-circle' color: 'green' runs: using: 'docker' image: 'Dockerfile' + args: + - ${{ inputs.args }} diff --git a/runner-entrypoint.sh b/runner-entrypoint.sh index 4cecba2..cd0e2a4 100755 --- a/runner-entrypoint.sh +++ b/runner-entrypoint.sh @@ -25,7 +25,7 @@ echo "Execute pipeline with branch $BRANCH" if [ -n "$TRIGGER_NAME" ] then - codefresh run $PIPELINE_NAME --trigger=$TRIGGER_NAME --branch=$BRANCH + codefresh run $PIPELINE_NAME --trigger=$TRIGGER_NAME --branch=$BRANCH ${@:1} else - codefresh run $PIPELINE_NAME --branch=$BRANCH + codefresh run $PIPELINE_NAME --branch=$BRANCH ${@:1} fi From c92cfe22556092f8c655afa42cf07afcdaf721d8 Mon Sep 17 00:00:00 2001 From: Brendon Lee Date: Fri, 15 Jan 2021 13:05:39 +0800 Subject: [PATCH 2/2] Use /bin/bash instead of /bin/sh --- runner-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner-entrypoint.sh b/runner-entrypoint.sh index cd0e2a4..85b5cc3 100755 --- a/runner-entrypoint.sh +++ b/runner-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # parse branch if [ -f $GITHUB_EVENT_PATH ]; then