From 89be6c1ba723740d71adbb03a4b4af4907e08442 Mon Sep 17 00:00:00 2001 From: Eric Willhoit Date: Tue, 30 Jun 2026 13:48:10 -0500 Subject: [PATCH] fix: allow passing node version into ctc open/close workflow --- .github/workflows/ctcClose.yml | 7 ++++- .github/workflows/ctcOpen.yml | 49 ++++++++++++++++++-------------- .github/workflows/npmPublish.yml | 3 ++ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ctcClose.yml b/.github/workflows/ctcClose.yml index 89b54a9..6d76f9d 100644 --- a/.github/workflows/ctcClose.yml +++ b/.github/workflows/ctcClose.yml @@ -10,6 +10,11 @@ on: description: CTC status, like "Implemented - per plan", "Not Implemented" default: Implemented - per plan type: string + nodeVersion: + description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers + type: string + default: lts/* + required: false jobs: ctcClose: @@ -19,7 +24,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: ${{ inputs.nodeVersion }} # No `cache: npm`: it requires an npm lockfile and so hard-fails on # pnpm/yarn consumer repos; the CTC CLI below is a one-off global install. - run: npm install -g @salesforce/change-case-management --omit=dev diff --git a/.github/workflows/ctcOpen.yml b/.github/workflows/ctcOpen.yml index a1c3231..4934fe2 100644 --- a/.github/workflows/ctcOpen.yml +++ b/.github/workflows/ctcOpen.yml @@ -2,8 +2,13 @@ on: workflow_call: inputs: githubTag: - description: 'The semver tag of the GitHub Release' + description: "The semver tag of the GitHub Release" type: string + nodeVersion: + description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers + type: string + default: lts/* + required: false outputs: changeCaseId: description: Id for the change case created @@ -19,7 +24,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: ${{ inputs.nodeVersion }} # No `cache: npm`: it requires an npm lockfile and so hard-fails on # pnpm/yarn consumer repos; the CTC CLI below is a one-off global install. @@ -29,28 +34,28 @@ jobs: id: ctc shell: bash run: | - # Temp disable exit on error - set +e - if [ -n "$GITHUB_TAG" ]; then - RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/$GITHUB_TAG" - else - RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases" - fi - CTC_RESULT=$(sfchangecase create --location ${{github.repositoryUrl}} --test-environment $RELEASE_URL --service platform-cli --release ${{github.repository}}.$(date +%F) --json) - # Re-enable exit on error - set -e + # Temp disable exit on error + set +e + if [ -n "$GITHUB_TAG" ]; then + RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/$GITHUB_TAG" + else + RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases" + fi + CTC_RESULT=$(sfchangecase create --location ${{github.repositoryUrl}} --test-environment $RELEASE_URL --service platform-cli --release ${{github.repository}}.$(date +%F) --json) + # Re-enable exit on error + set -e - STATUS=$(printf '%s' "$CTC_RESULT" | jq -r '.status') - CTC_ID=$(printf '%s' "$CTC_RESULT" | jq -r '.result.id') + STATUS=$(printf '%s' "$CTC_RESULT" | jq -r '.status') + CTC_ID=$(printf '%s' "$CTC_RESULT" | jq -r '.result.id') - if [[ "$STATUS" == "0" && "$CTC_ID" != "null" ]]; then - echo "Successfully created case with ID: $CTC_ID" - echo "ctcId=$CTC_ID" >> "$GITHUB_OUTPUT" - else - echo "CTC failed to open a case. Result:" - echo "$CTC_RESULT" - exit 1 - fi + if [[ "$STATUS" == "0" && "$CTC_ID" != "null" ]]; then + echo "Successfully created case with ID: $CTC_ID" + echo "ctcId=$CTC_ID" >> "$GITHUB_OUTPUT" + else + echo "CTC failed to open a case. Result:" + echo "$CTC_RESULT" + exit 1 + fi env: GITHUB_TAG: ${{ inputs.githubTag }} SF_CHANGE_CASE_SFDX_AUTH_URL: ${{ secrets.SF_CHANGE_CASE_SFDX_AUTH_URL}} diff --git a/.github/workflows/npmPublish.yml b/.github/workflows/npmPublish.yml index 5b1f5a4..76f664e 100644 --- a/.github/workflows/npmPublish.yml +++ b/.github/workflows/npmPublish.yml @@ -121,6 +121,7 @@ jobs: uses: salesforcecli/github-workflows/.github/workflows/ctcOpen.yml@main with: githubTag: ${{ inputs.githubTag }} + nodeVersion: ${{ inputs.nodeVersion }} secrets: inherit npm-publish: @@ -299,6 +300,7 @@ jobs: secrets: inherit with: changeCaseId: ${{needs.ctc-open.outputs.changeCaseId}} + nodeVersion: ${{ inputs.nodeVersion }} ctcCloseFail: needs: [ctc-open, npm-publish] @@ -307,4 +309,5 @@ jobs: secrets: inherit with: changeCaseId: ${{ needs.ctc-open.outputs.changeCaseId }} + nodeVersion: ${{ inputs.nodeVersion }} status: Not Implemented