From 75f004d8f5931ef546fcd03eab88ae14642dbe79 Mon Sep 17 00:00:00 2001 From: cweinberger Date: Tue, 3 Mar 2026 00:35:30 +0100 Subject: [PATCH] fix: populate Slack notification fields on workflow_dispatch When deployments are triggered via workflow_dispatch (manual trigger), the GitHub event payload lacks head_commit and pusher data, causing Committer, Message, and Change to show as null in Slack notifications. This adds a step that fetches the HEAD commit info via the GitHub API and writes a push-compatible event file before the notifier runs. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/component-initialize.yml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/component-initialize.yml b/.github/workflows/component-initialize.yml index 5940356..10f0905 100644 --- a/.github/workflows/component-initialize.yml +++ b/.github/workflows/component-initialize.yml @@ -35,6 +35,30 @@ jobs: slack-message-id: ${{ steps.send-slack-message.outputs.slack-message-id }} slack-channel-id: ${{ steps.send-slack-message.outputs.slack-channel-id }} steps: + - name: Enrich event for workflow_dispatch + if: github.event_name == 'workflow_dispatch' + env: + GH_TOKEN: ${{ github.token }} + shell: bash + run: | + # workflow_dispatch events don't include commit info, causing + # null Committer/Message/Change in Slack notifications. + # Fetch HEAD commit info and write a push-compatible event file + # so the slack-notifier-cli can parse it. + gh api "repos/${{ github.repository }}/commits/${{ github.sha }}" \ + --jq '{ + head_commit: { + id: .sha, + message: .commit.message, + author: .commit.author, + committer: .commit.committer + }, + pusher: { + name: (.commit.author.name // "${{ github.triggering_actor }}"), + email: (.commit.author.email // "") + } + }' > "$GITHUB_EVENT_PATH" + - name: Send slack message id: send-slack-message uses: monta-app/slack-notifier-cli-action@main