From d46c10a293d623c2e2b71481aed440ded90bd50a Mon Sep 17 00:00:00 2001 From: David Bernard Date: Mon, 16 Sep 2024 12:14:35 +0200 Subject: [PATCH 1/6] fix: support token with space like `Bearer xxxxx` I guess, having token like `Bearer xxxx` is the cause of an error like ```sh -- Running release-plz release -- error: unexpected argument '***' found Usage: release-plz release [OPTIONS] For more information, try '--help'. ``` --- action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index f6d2587..a25e020 100644 --- a/action.yml +++ b/action.yml @@ -75,7 +75,7 @@ runs: if [[ -n "${{ inputs.token }}" ]] then echo "using custom registry token'" - TOKEN="--token ${{ inputs.token }}" + TOKEN="--token '${{ inputs.token }}'" else TOKEN="" fi @@ -83,7 +83,7 @@ runs: if [[ -n "${{ inputs.backend }}" ]] then echo "using backend '${{ inputs.backend }}'" - BACKEND="--backend ${{ inputs.backend }}" + BACKEND="--backend '${{ inputs.backend }}'" else BACKEND="" fi @@ -91,7 +91,7 @@ runs: if [[ -n "${{ inputs.registry }}" ]] then echo "using registry '${{ inputs.registry }}'" - ALT_REGISTRY="--registry ${{ inputs.registry }}" + ALT_REGISTRY="--registry '${{ inputs.registry }}'" else ALT_REGISTRY="" fi @@ -99,11 +99,11 @@ runs: if [[ -n "${{ inputs.manifest_path }}" ]] then echo "using manifest path '${{ inputs.manifest_path }}'" - MANIFEST_PATH="--manifest-path ${{ inputs.manifest_path }}" + MANIFEST_PATH="--manifest-path '${{ inputs.manifest_path }}'" elif [[ -n "${{ inputs.project_manifest }}" ]] then echo "using manifest path '${{ inputs.project_manifest }}'" - MANIFEST_PATH="--project-manifest ${{ inputs.project_manifest }}" + MANIFEST_PATH="--project-manifest '${{ inputs.project_manifest }}'" else MANIFEST_PATH="" fi From 4f143463c16cf2e881bde7f7fdff01b73656dff3 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Mon, 16 Sep 2024 15:36:42 +0200 Subject: [PATCH 2/6] fix: some inputs are already quoted --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a25e020..f03fec3 100644 --- a/action.yml +++ b/action.yml @@ -83,7 +83,7 @@ runs: if [[ -n "${{ inputs.backend }}" ]] then echo "using backend '${{ inputs.backend }}'" - BACKEND="--backend '${{ inputs.backend }}'" + BACKEND="--backend ${{ inputs.backend }}" else BACKEND="" fi From 44a91945f281d29edb004c78452e37e1e39b7ffd Mon Sep 17 00:00:00 2001 From: davidB Date: Mon, 16 Sep 2024 23:02:02 +0200 Subject: [PATCH 3/6] fix: use an array to expand arguments and preserving space in value --- action.yml | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/action.yml b/action.yml index f03fec3..825d3e6 100644 --- a/action.yml +++ b/action.yml @@ -67,57 +67,57 @@ runs: if [[ -n "${{ inputs.config }}" ]] then echo "using config from '${{ inputs.config }}'" - CONFIG_PATH="--config ${{ inputs.config }}" + CONFIG_PATH=("--config" "${{ inputs.config }}") else - CONFIG_PATH="" + CONFIG_PATH=() fi if [[ -n "${{ inputs.token }}" ]] then echo "using custom registry token'" - TOKEN="--token '${{ inputs.token }}'" + TOKEN=("--token" "${{ inputs.token }}") else - TOKEN="" + TOKEN=() fi if [[ -n "${{ inputs.backend }}" ]] then echo "using backend '${{ inputs.backend }}'" - BACKEND="--backend ${{ inputs.backend }}" + BACKEND=("--backend" "${{ inputs.backend }}") else - BACKEND="" + BACKEND=() fi if [[ -n "${{ inputs.registry }}" ]] then echo "using registry '${{ inputs.registry }}'" - ALT_REGISTRY="--registry '${{ inputs.registry }}'" + ALT_REGISTRY=("--registry" "${{ inputs.registry }}") else - ALT_REGISTRY="" + ALT_REGISTRY=() fi if [[ -n "${{ inputs.manifest_path }}" ]] then echo "using manifest path '${{ inputs.manifest_path }}'" - MANIFEST_PATH="--manifest-path '${{ inputs.manifest_path }}'" + MANIFEST_PATH=("--manifest-path "${{ inputs.manifest_path }}") elif [[ -n "${{ inputs.project_manifest }}" ]] then echo "using manifest path '${{ inputs.project_manifest }}'" - MANIFEST_PATH="--project-manifest '${{ inputs.project_manifest }}'" + MANIFEST_PATH=("--project-manifest" "${{ inputs.project_manifest }}") else - MANIFEST_PATH="" + MANIFEST_PATH=() fi if [[ -z "${{ inputs.command }}" || "${{ inputs.command }}" == "release-pr" ]] then echo "-- Running release-plz release-pr --" release_pr_output=$(release-plz release-pr\ - --git-token ${GITHUB_TOKEN}\ - --repo-url https://github.com/${GITHUB_REPOSITORY}\ - ${CONFIG_PATH}\ - ${ALT_REGISTRY}\ - ${MANIFEST_PATH}\ - ${BACKEND}\ + --git-token "${GITHUB_TOKEN}"\ + --repo-url "https://github.com/${GITHUB_REPOSITORY}"\ + "${CONFIG_PATH[@]}"\ + "${ALT_REGISTRY[@]}"\ + "${MANIFEST_PATH[@]}"\ + "${BACKEND[@]}"\ -o json) echo "release_pr_output: $release_pr_output" prs=$(echo $release_pr_output | jq -c .prs) @@ -138,12 +138,12 @@ runs: then echo "-- Running release-plz release --" release_output=$(release-plz release\ - --git-token ${GITHUB_TOKEN}\ - ${CONFIG_PATH}\ - ${ALT_REGISTRY}\ - ${MANIFEST_PATH}\ - ${BACKEND}\ - ${TOKEN}\ + --git-token "${GITHUB_TOKEN}"\ + "${CONFIG_PATH[@]}"\ + "${ALT_REGISTRY[@]}\ + "${MANIFEST_PATH[@]}\ + "${BACKEND[@]}\ + "${TOKEN[@]}\ -o json) echo "release_output: $release_output" releases=$(echo $release_output | jq -c .releases) From 48ae6697cb0a39f4909fe50e72d26d8bbfbb1e6e Mon Sep 17 00:00:00 2001 From: davidB Date: Mon, 16 Sep 2024 23:03:46 +0200 Subject: [PATCH 4/6] fix: missing quote --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 825d3e6..f34a3e5 100644 --- a/action.yml +++ b/action.yml @@ -140,10 +140,10 @@ runs: release_output=$(release-plz release\ --git-token "${GITHUB_TOKEN}"\ "${CONFIG_PATH[@]}"\ - "${ALT_REGISTRY[@]}\ - "${MANIFEST_PATH[@]}\ - "${BACKEND[@]}\ - "${TOKEN[@]}\ + "${ALT_REGISTRY[@]}"\ + "${MANIFEST_PATH[@]}"\ + "${BACKEND[@]}"\ + "${TOKEN[@]}"\ -o json) echo "release_output: $release_output" releases=$(echo $release_output | jq -c .releases) From 8edfc23b021046547e03cd57c5e89c1e7fa86420 Mon Sep 17 00:00:00 2001 From: davidB Date: Tue, 17 Sep 2024 09:48:09 +0200 Subject: [PATCH 5/6] fix: missing quote --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f34a3e5..926507b 100644 --- a/action.yml +++ b/action.yml @@ -99,7 +99,7 @@ runs: if [[ -n "${{ inputs.manifest_path }}" ]] then echo "using manifest path '${{ inputs.manifest_path }}'" - MANIFEST_PATH=("--manifest-path "${{ inputs.manifest_path }}") + MANIFEST_PATH=("--manifest-path" "${{ inputs.manifest_path }}") elif [[ -n "${{ inputs.project_manifest }}" ]] then echo "using manifest path '${{ inputs.project_manifest }}'" From ddd5fdc47eb83f60c5b0c7aea20b57dd033d51a1 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 17 Sep 2024 10:43:26 +0200 Subject: [PATCH 6/6] docs: explain use of array Co-authored-by: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com> --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index fe1baa9..6d4c2fc 100644 --- a/action.yml +++ b/action.yml @@ -67,6 +67,7 @@ runs: if [[ -n "${{ inputs.config }}" ]] then echo "using config from '${{ inputs.config }}'" + # Use arrays so that inputs can contain spaces CONFIG_PATH=("--config" "${{ inputs.config }}") else CONFIG_PATH=()