From c294d51533edc3cbca3b295c19fa691e762d6744 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 30 Mar 2026 10:02:01 +0200 Subject: [PATCH 1/2] feat(send-slack-notificaion: Support customizing message subject --- .github/workflows/smoke-build.yaml | 5 ++++- send-slack-notification/action.yaml | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smoke-build.yaml b/.github/workflows/smoke-build.yaml index b78d7cb..2483225 100644 --- a/.github/workflows/smoke-build.yaml +++ b/.github/workflows/smoke-build.yaml @@ -150,5 +150,8 @@ jobs: publish-manifests-result: ${{ needs.publish-manifests.result }} build-result: ${{ needs.build-container-image.result }} slack-token: ${{ secrets.SLACK_CONTAINER_IMAGE_TOKEN }} - channel-id: C07UG6JH44F # notifications-container-images + # This tests that the subject is correctly overwritten + message-subject: Build actions/smoke container image + # notifications-container-images + channel-id: C07UG6JH44F type: container-image-build diff --git a/send-slack-notification/action.yaml b/send-slack-notification/action.yaml index 0497d9c..3e98837 100644 --- a/send-slack-notification/action.yaml +++ b/send-slack-notification/action.yaml @@ -23,6 +23,10 @@ inputs: description: The list (plain text) of failed tests slack-token: description: The Slack token + message-subject: + description: | + The main message subject of the notification message. This defaults to github.workflow for + build notifications and github.repository for integration test notifications. runs: using: composite steps: @@ -88,11 +92,17 @@ runs: SLACK_THREAD_YAML: | ${{ steps.retrieve-slack-thread-id.outcome == 'success' && format('thread_ts: "{0}"', env.SLACK_THREAD_ID) || '' }} CHANNEL_ID: ${{ inputs.channel-id }} + MESSAGE_SUBJECT: ${{ inputs.message-subject }} shell: bash run: | export WORKFLOW_RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}" if [ "$NOTIFICATION_TYPE" == "container-image-build" ]; then + # Only override the message subject with the default value if it is empty + if [ -z "${MESSAGE_SUBJECT:-}" ]; then + export MESSAGE_SUBJECT="$GITHUB_WORKFLOW" + fi + # TODO (@Techassi): Also add success template if [ "$PUBLISH_MANIFESTS_RESULT" = "failure" ] || [ "$PUBLISH_HELM_CHART_RESULT" = "failure" ] || [ "$BUILD_RESULT" = "failure" ]; then export MESSAGE_VERB=failed @@ -102,19 +112,24 @@ runs: export MESSAGE_COLOR=10c400 fi - export MESSAGE_TEXT="*$GITHUB_WORKFLOW* $MESSAGE_VERB (attempt $GITHUB_RUN_ATTEMPT)" + export MESSAGE_TEXT="*$MESSAGE_SUBJECT* $MESSAGE_VERB (attempt $GITHUB_RUN_ATTEMPT)" PAYLOAD=$(envsubst < "${GITHUB_ACTION_PATH}/templates/container-image-build/failure.tpl") echo -e "PAYLOAD< Date: Mon, 30 Mar 2026 10:15:36 +0200 Subject: [PATCH 2/2] docs(send-slack-notification): Add new message-subject input --- send-slack-notification/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/send-slack-notification/README.md b/send-slack-notification/README.md index e9dc6e5..6e432c4 100644 --- a/send-slack-notification/README.md +++ b/send-slack-notification/README.md @@ -65,6 +65,8 @@ jobs: - `build-result` (optional, e.g. `success`) - `publish-manifests-result` (optional, e.g. `failure`) - `publish-helm-chart-result` (optional, e.g. `failure`) +- `message-subject` (optional, defaults to `github.workflow` for `container-image-build` and + `github.repository` for `integration-test`) ### Outputs