From 5d806abb13480ea10671ca475cc0d52be10f0790 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 15 Apr 2024 13:19:24 -0700 Subject: [PATCH] fix: iterate over releases from env var (#429) This fixes an issue where single quotes within releases were not escaped. Copied directly from https://github.com/npm/proc-log/pull/79 --- .github/workflows/release-integration.yml | 3 ++- lib/content/_job-release-integration-yml.hbs | 3 ++- tap-snapshots/test/apply/source-snapshots.js.test.cjs | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-integration.yml b/.github/workflows/release-integration.yml index 36637581..d986e4be 100644 --- a/.github/workflows/release-integration.yml +++ b/.github/workflows/release-integration.yml @@ -54,6 +54,7 @@ jobs: - name: Publish env: PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} + RELEASES: ${{ inputs.releases }} run: | EXIT_CODE=0 @@ -65,7 +66,7 @@ jobs: fi } - for release in $(echo '${{ inputs.releases }}' | jq -r '.[] | @base64'); do + for release in $(echo $RELEASES | jq -r '.[] | @base64'); do PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag) STATUS=$(each_release "$PUBLISH_TAG") if [[ "$STATUS" -eq 1 ]]; then diff --git a/lib/content/_job-release-integration-yml.hbs b/lib/content/_job-release-integration-yml.hbs index d0da5ed8..4596acdc 100644 --- a/lib/content/_job-release-integration-yml.hbs +++ b/lib/content/_job-release-integration-yml.hbs @@ -15,6 +15,7 @@ steps: - name: Publish env: PUBLISH_TOKEN: $\{{ secrets.PUBLISH_TOKEN }} + RELEASES: $\{{ inputs.releases }} {{else}} {{> stepsSetupYml }} - name: Check If Published @@ -30,7 +31,7 @@ steps: fi } - for release in $(echo '$\{{ inputs.releases }}' | jq -r '.[] | @base64'); do + for release in $(echo $RELEASES | jq -r '.[] | @base64'); do {{#if publish}} PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag) STATUS=$(each_release "$PUBLISH_TAG") diff --git a/tap-snapshots/test/apply/source-snapshots.js.test.cjs b/tap-snapshots/test/apply/source-snapshots.js.test.cjs index 83e02510..c649b4d7 100644 --- a/tap-snapshots/test/apply/source-snapshots.js.test.cjs +++ b/tap-snapshots/test/apply/source-snapshots.js.test.cjs @@ -897,7 +897,7 @@ jobs: fi } - for release in $(echo '\${{ inputs.releases }}' | jq -r '.[] | @base64'); do + for release in $(echo $RELEASES | jq -r '.[] | @base64'); do SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)" STATUS=$(each_release "$SPEC") if [[ "$STATUS" -eq 1 ]]; then @@ -2539,7 +2539,7 @@ jobs: fi } - for release in $(echo '\${{ inputs.releases }}' | jq -r '.[] | @base64'); do + for release in $(echo $RELEASES | jq -r '.[] | @base64'); do SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)" STATUS=$(each_release "$SPEC") if [[ "$STATUS" -eq 1 ]]; then @@ -4053,7 +4053,7 @@ jobs: fi } - for release in $(echo '\${{ inputs.releases }}' | jq -r '.[] | @base64'); do + for release in $(echo $RELEASES | jq -r '.[] | @base64'); do SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)" STATUS=$(each_release "$SPEC") if [[ "$STATUS" -eq 1 ]]; then