From 18dafe2553c5c80bc0f7d2661be7cae6e9e36cee Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 31 Jan 2024 11:29:22 +0300 Subject: [PATCH 1/3] fix: inputs interpolation --- action.yml | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 74da575..4cdd755 100644 --- a/action.yml +++ b/action.yml @@ -132,13 +132,35 @@ runs: shell: bash working-directory: ${{ inputs.working-directory }} run: | + function print_assignment { + echo "$(echo "$1=$2" | tr '\n' ' ')" + } + { - echo "stack-query-arguments=$( echo "${{ inputs.query-arguments }}" | tr '\n' ' ')" - echo "stack-path-arguments=$( echo "${{ inputs.path-arguments }}" | tr '\n' ' ')" - echo "stack-setup-arguments=$( echo "${{ inputs.setup-arguments }}" | tr '\n' ' ')" - echo "stack-build-arguments-dependencies=$(echo "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-dependencies }}" | tr '\n' ' ')" - echo "stack-build-arguments-build=$( echo "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-build }}" | tr '\n' ' ')" - echo "stack-build-arguments-test=$( echo "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-test }}" | tr '\n' ' ')" + print_assignment "stack-query-arguments" "$(cat <> "$GITHUB_OUTPUT" has_resolver() { @@ -155,7 +177,11 @@ runs: echo "resolver-nightly=$resolver_nightly" >>"$GITHUB_OUTPUT" - echo "stack-arguments=--stack-yaml ${{ inputs.stack-yaml }} $resolver_nightly $(echo "${{ inputs.stack-arguments }}" | tr '\n' ' ')" >>"$GITHUB_OUTPUT" + print_assignment "stack-arguments" "$(cat <> "$GITHUB_OUTPUT" echo 'stack-works<>"$GITHUB_OUTPUT" # We can't just list out '**/.stack-work' because the files may not From 15aff7cb4c669d999728fb89555e96b955274dd1 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 31 Jan 2024 18:46:42 +0300 Subject: [PATCH 2/3] refactor: print_assignment --- action.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/action.yml b/action.yml index 4cdd755..a24434f 100644 --- a/action.yml +++ b/action.yml @@ -132,35 +132,36 @@ runs: shell: bash working-directory: ${{ inputs.working-directory }} run: | - function print_assignment { - echo "$(echo "$1=$2" | tr '\n' ' ')" + print_assignment() { + printf '%s=' "$1" + tr '\n' ' ' } { - print_assignment "stack-query-arguments" "$(cat <> "$GITHUB_OUTPUT" has_resolver() { @@ -177,11 +178,10 @@ runs: echo "resolver-nightly=$resolver_nightly" >>"$GITHUB_OUTPUT" - print_assignment "stack-arguments" "$(cat <> "$GITHUB_OUTPUT" <> "$GITHUB_OUTPUT" echo 'stack-works<>"$GITHUB_OUTPUT" # We can't just list out '**/.stack-work' because the files may not From babaf257db37fdbe0c6a87354b0128aa7707152d Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Wed, 31 Jan 2024 18:57:57 +0300 Subject: [PATCH 3/3] try: print newline --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index a24434f..c3aa0b4 100644 --- a/action.yml +++ b/action.yml @@ -135,6 +135,7 @@ runs: print_assignment() { printf '%s=' "$1" tr '\n' ' ' + printf '\n' } {