Skip to content

Commit ccbc19a

Browse files
committed
fix: include review items in docs-sync Slack notification
The warning notification for files needing manual review was sending 'see workflow run for details' with no actionable information. - Read review-items.txt and include file list in the Slack message - Use jq for proper JSON escaping (handles newlines, quotes, special chars) - Guard against missing review-items.txt with fallback and ::warning:: - Review-needed notification fires independently of push/merge outcome
1 parent 32fb263 commit ccbc19a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/showcase_docs-sync.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ jobs:
5959
elif [ $EXIT_CODE -eq 3 ]; then
6060
echo "Has review items + clean transforms"
6161
echo "action=push_and_pr" >> "$GITHUB_OUTPUT"
62+
if [ -f review-items.txt ]; then
63+
REVIEW_ITEMS=$(cat review-items.txt)
64+
else
65+
echo "::warning::review-items.txt not found despite exit code 3 — sync script may have a bug"
66+
REVIEW_ITEMS="(review-items.txt not found — check sync script output)"
67+
fi
68+
# JSON-escape review items for embedding in Slack payload
69+
REVIEW_ITEMS_JSON=$(echo "$REVIEW_ITEMS" | jq -Rs '.' | sed 's/^"//;s/"$//')
70+
echo "review_items_json=${REVIEW_ITEMS_JSON}" >> "$GITHUB_OUTPUT"
6271
else
6372
echo "Sync failed with exit code $EXIT_CODE"
6473
exit 1
@@ -142,7 +151,7 @@ jobs:
142151
webhook: ${{ secrets.SLACK_WEBHOOK_OSS_ALERTS }}
143152
webhook-type: incoming-webhook
144153
payload: |
145-
{ "text": ":warning: *Docs sync*: files needing manual review — see workflow run for details\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" }
154+
{ "text": ":warning: *Docs sync*: files needing manual review\n```${{ steps.sync.outputs.review_items_json }}```\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" }
146155
147156
- name: Notify Slack (failure)
148157
if: failure() && steps.push.outputs.pr_url == ''

0 commit comments

Comments
 (0)