Skip to content

Commit 8a1b6fc

Browse files
committed
ci(docs-sync): include PR link in review-needed Slack alert
The "files needing manual review" Slack warning listed files but didn't link the auto-opened PR, forcing reviewers to hunt for it in GitHub. Capture the PR URL from the create/merge step output (already exposed as steps.push.outputs.pr_url) and include it as a "Review:" line in the payload. Split the alert into two variants: - PR opened (normal case): includes the PR link - No PR opened (edge case where clean-transform portion was empty): posts review items without a link Auto-sync and merge-failed alerts already linked the PR — this brings the review-needed alert to parity.
1 parent 8424575 commit 8a1b6fc

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/showcase_docs-sync.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,26 @@ jobs:
142142
{ "text": ":warning: *Docs sync*: PR created but auto-merge FAILED — needs manual merge\n${{ steps.push.outputs.pr_url }}\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" }
143143
144144
# Review items = files the sync script flagged but did NOT write to disk
145-
# (local modifications, files deleted on main). No file changes to propose —
146-
# just alert Slack so a human can manually reconcile.
145+
# (local modifications, files deleted on main). A PR may have been opened
146+
# for the clean-transform portion — link it so reviewers can click through.
147147
- name: Notify Slack (review needed)
148-
if: always() && steps.sync.outputs.action == 'push_and_pr'
148+
if: always() && steps.sync.outputs.action == 'push_and_pr' && steps.push.outputs.pr_url != ''
149149
uses: slackapi/slack-github-action@v2.1.0
150150
with:
151151
webhook: ${{ secrets.SLACK_WEBHOOK_OSS_ALERTS }}
152152
webhook-type: incoming-webhook
153153
payload: |
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>" }
154+
{ "text": ":warning: *Docs sync*: files needing manual review\n```${{ steps.sync.outputs.review_items_json }}```\nReview: ${{ steps.push.outputs.pr_url }}\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" }
155+
156+
# Fallback: review items but no PR was opened (clean-transform portion was empty).
157+
- name: Notify Slack (review needed, no PR)
158+
if: always() && steps.sync.outputs.action == 'push_and_pr' && steps.push.outputs.pr_url == ''
159+
uses: slackapi/slack-github-action@v2.1.0
160+
with:
161+
webhook: ${{ secrets.SLACK_WEBHOOK_OSS_ALERTS }}
162+
webhook-type: incoming-webhook
163+
payload: |
164+
{ "text": ":warning: *Docs sync*: files needing manual review (no auto-PR opened)\n```${{ steps.sync.outputs.review_items_json }}```\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" }
155165
156166
- name: Notify Slack (failure)
157167
if: failure() && steps.push.outputs.pr_url == ''

0 commit comments

Comments
 (0)