Skip to content
Open
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
20 changes: 19 additions & 1 deletion .github/workflows/cicd_comp_deployment-phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,23 @@ jobs:
> `npm i -g @dotcms/dotcli@${{ steps.cli_publish.outputs.npm-package-version-tag }}`
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}

# Extract PR info from the merge commit message for SDK notification
- name: Extract PR from commit message
id: pr_info
if: success() && steps.sdks_publish.outputs.published == 'true'
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
PR_NUMBER=$(echo "$COMMIT_MSG" | grep -oP '#\K[0-9]+' | head -1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @KevinDavilaDotCMS — nice addition, having the originating PR in the SDK announcement will be really useful. I think there's one edge case worth addressing here before merge.

GitHub Actions runs run: steps with bash --noprofile --norc -eo pipefail {0} by default. On this line:

PR_NUMBER=$(echo "$COMMIT_MSG" | grep -oP '#\K[0-9]+' | head -1)

if grep finds no matches, it exits with status 1. With pipefail enabled, that non-zero status propagates through the pipeline and the whole step fails before reaching the if [ -n "$PR_NUMBER" ] check, so the SHA fallback in the else branch never gets a chance to run.

This matters in two scenarios:

  1. A push whose head commit message simply has no #NNN reference.
  2. Callers where github.event.head_commit.message is empty — e.g., the workflow_dispatch paths in cicd_4-nightly.yml and cicd_8-manual-deploy.yml, which also call this reusable workflow with publish-npm-sdk-libs enabled.

Since the next Slack step is gated on if: success() && steps.sdks_publish.outputs.published == 'true', the practical effect is that no Slack notification is sent at all in those cases — the opposite of what the fallback is meant to do.

Minimal fix to let the fallback work as intended:

Suggested change
PR_NUMBER=$(echo "$COMMIT_MSG" | grep -oP '#\K[0-9]+' | head -1)
PR_NUMBER=$(echo "$COMMIT_MSG" | grep -oP '#\K[0-9]+' | head -1 || true)

Thanks for picking this up!

if [ -n "$PR_NUMBER" ]; then
echo "pr_url=${{ github.server_url }}/${{ github.repository }}/pull/$PR_NUMBER" >> $GITHUB_OUTPUT
echo "pr_ref=#${PR_NUMBER}" >> $GITHUB_OUTPUT
else
echo "pr_url=${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}" >> $GITHUB_OUTPUT
echo "pr_ref=$(echo '${{ github.sha }}' | cut -c1-7)" >> $GITHUB_OUTPUT
fi
shell: bash

# Send Slack notification for SDK publication (if required)
- name: Slack Notification (SDK announcement)
if: success() && steps.sdks_publish.outputs.published == 'true'
Expand All @@ -378,4 +395,5 @@ jobs:
> :large_orange_circle: *Attention dotters:* SDK libs (Angular, Client, Experiments and React) published!
>
> This automated script is happy to announce that a new *_SDK libs_* version *tagged as:* [ `${{ steps.sdks_publish.outputs.npm-package-version }}` ] is now available on the `NPM` registry :package:!
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
> *Introduced by:* <${{ steps.pr_info.outputs.pr_url }}|${{ steps.pr_info.outputs.pr_ref }}>
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/cicd_manual-release-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ jobs:
publish-latest: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Slack Notification (SDK release announcement)'
if: success() && steps.deploy-javascript-sdk.outputs.published == 'true'
continue-on-error: true
uses: ./.github/actions/core-cicd/notification/notify-slack
with:
channel-id: "log-sdk-libs"
payload: |
> :large_green_circle: *Attention dotters:* SDK libs (Angular, Client, Experiments and React) officially released!
>
> This automated script is happy to announce that a new *_SDK libs_* version *tagged as:* [ `${{ steps.deploy-javascript-sdk.outputs.npm-package-version }}` ] is now available on the `NPM` registry :package:!
> *Release type:* `${{ inputs.version-type }}` | *Triggered by:* `${{ github.actor }}`
> <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}

- name: 'Open post-release PR to bump VERSION on main'
env:
RELEASE_VERSION: ${{ steps.compute_version.outputs.release_version }}
Expand Down
Loading