Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ctcClose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
49 changes: 27 additions & 22 deletions .github/workflows/ctcOpen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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}}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/npmPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -299,6 +300,7 @@ jobs:
secrets: inherit
with:
changeCaseId: ${{needs.ctc-open.outputs.changeCaseId}}
nodeVersion: ${{ inputs.nodeVersion }}

ctcCloseFail:
needs: [ctc-open, npm-publish]
Expand All @@ -307,4 +309,5 @@ jobs:
secrets: inherit
with:
changeCaseId: ${{ needs.ctc-open.outputs.changeCaseId }}
nodeVersion: ${{ inputs.nodeVersion }}
status: Not Implemented