@@ -19,15 +19,16 @@ jobs:
19
19
node-version : ' 18.x'
20
20
registry-url : ' https://registry.npmjs.org'
21
21
# Extract the dynamic value from the canary label if present
22
- - name : Extract dynamic value from canary label
22
+ - name : Extract CANARY_TAG
23
23
id : extract-canary
24
24
run : |
25
- if [[ "${GITHUB_EVENT_LABEL_NAME}" == canary:* ]]; then
26
- CANARY_TAG="${GITHUB_EVENT_LABEL_NAME#canary:}"
27
- echo "CANARY_TAG=${CANARY_TAG}" >> $GITHUB_ENV
28
- fi
29
- env :
30
- GITHUB_EVENT_LABEL_NAME : ${{ github.event.label.name }}
25
+ export LABELS_JSON='${{ toJson(github.event.pull_request.labels) }}'
26
+ CANARY_TAG=$(node -e "
27
+ const labels = JSON.parse(process.env.LABELS_JSON || '[]');
28
+ const canaryLabel = labels.find(label => label.name.startsWith('canary:'));
29
+ if (canaryLabel) console.log(canaryLabel.name.split(':')[1]);
30
+ ")
31
+ echo "CANARY_TAG=$CANARY_TAG" >> $GITHUB_ENV
31
32
# Ensure that the README is published with the package
32
33
- run : rm -f packages/cli/README.md && cp README.md packages/cli
33
34
- run : echo "PR_VERSION=0.0.0-pr.${{github.event.pull_request.number}}.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
@@ -36,10 +37,13 @@ jobs:
36
37
# Publish to npm with the additional tag if CANARY_TAG is set
37
38
- run : |
38
39
npm publish --workspace packages/cli --tag experimental
39
- if [[ -n "${{ env.CANARY_TAG }}" ]]; then
40
- npm dist-tag add checkly@${{ env.PR_VERSION }} ${{ env.CANARY_TAG }}
41
- fi
40
+ if [[ -n "$CANARY_TAG" ]]; then
41
+ echo "Publishing with additional tag: $CANARY_TAG"
42
+ npm dist-tag add checkly@$PR_VERSION $CANARY_TAG
43
+ fi
42
44
env:
45
+ CANARY_TAG: ${{ env.CANARY_TAG }}
46
+ PR_VERSION: ${{ env.PR_VERSION }}
43
47
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44
48
- uses : marocchino/sticky-pull-request-comment@v2
45
49
with :
0 commit comments