From c335fdf317990cad84b954fc04930728896ab542 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 18 Aug 2026 09:48:59 -0400 Subject: [PATCH 1/3] feat: add Craft Cloud review notifications --- .../workflows/notify-craft-cloud-review.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/notify-craft-cloud-review.yml diff --git a/.github/workflows/notify-craft-cloud-review.yml b/.github/workflows/notify-craft-cloud-review.yml new file mode 100644 index 0000000..3f53bce --- /dev/null +++ b/.github/workflows/notify-craft-cloud-review.yml @@ -0,0 +1,41 @@ +name: Notify Craft Cloud review requests + +on: + workflow_call: + secrets: + slack_webhook_url: + required: true + +permissions: {} + +jobs: + notify: + if: github.event.requested_team.slug == 'craft-cloud' + runs-on: ubuntu-latest + steps: + - name: Post to Slack + env: + SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_url }} + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_URL: ${{ github.event.pull_request.html_url }} + REPOSITORY: ${{ github.repository }} + run: | + jq -n \ + --arg author "$PR_AUTHOR" \ + --arg number "$PR_NUMBER" \ + --arg repository "$REPOSITORY" \ + --arg title "$PR_TITLE" \ + --arg url "$PR_URL" \ + '{ + text: "Craft Cloud review requested", + blocks: [ + {type: "section", text: {type: "mrkdwn", text: ("*Review requested:* <" + $url + "|" + $repository + " #" + $number + ">")}}, + {type: "section", text: {type: "plain_text", text: ($title + " — by @" + $author), emoji: true}} + ] + }' | + curl --fail-with-body --silent --show-error \ + --header 'Content-type: application/json' \ + --data @- \ + "$SLACK_WEBHOOK_URL" From 36a884e8dc6d262d0aae4ea10af704ec91e70479 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 18 Aug 2026 11:52:50 -0400 Subject: [PATCH 2/3] refactor: generalize PR Slack notification --- ...fy-craft-cloud-review.yml => pr-slack-notification.yml} | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename .github/workflows/{notify-craft-cloud-review.yml => pr-slack-notification.yml} (84%) diff --git a/.github/workflows/notify-craft-cloud-review.yml b/.github/workflows/pr-slack-notification.yml similarity index 84% rename from .github/workflows/notify-craft-cloud-review.yml rename to .github/workflows/pr-slack-notification.yml index 3f53bce..944e20a 100644 --- a/.github/workflows/notify-craft-cloud-review.yml +++ b/.github/workflows/pr-slack-notification.yml @@ -1,4 +1,4 @@ -name: Notify Craft Cloud review requests +name: PR Slack Notification on: workflow_call: @@ -10,7 +10,6 @@ permissions: {} jobs: notify: - if: github.event.requested_team.slug == 'craft-cloud' runs-on: ubuntu-latest steps: - name: Post to Slack @@ -29,9 +28,9 @@ jobs: --arg title "$PR_TITLE" \ --arg url "$PR_URL" \ '{ - text: "Craft Cloud review requested", + text: "Pull request notification", blocks: [ - {type: "section", text: {type: "mrkdwn", text: ("*Review requested:* <" + $url + "|" + $repository + " #" + $number + ">")}}, + {type: "section", text: {type: "mrkdwn", text: ("*Pull request:* <" + $url + "|" + $repository + " #" + $number + ">")}}, {type: "section", text: {type: "plain_text", text: ($title + " — by @" + $author), emoji: true}} ] }' | From cbf354e84c1e7f805da7788f543f2103e257b23c Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 18 Aug 2026 12:02:27 -0400 Subject: [PATCH 3/3] fix: fail Slack notifications on payload errors --- .github/workflows/pr-slack-notification.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-slack-notification.yml b/.github/workflows/pr-slack-notification.yml index 944e20a..d030c45 100644 --- a/.github/workflows/pr-slack-notification.yml +++ b/.github/workflows/pr-slack-notification.yml @@ -21,6 +21,8 @@ jobs: PR_URL: ${{ github.event.pull_request.html_url }} REPOSITORY: ${{ github.repository }} run: | + set -o pipefail + jq -n \ --arg author "$PR_AUTHOR" \ --arg number "$PR_NUMBER" \