Add carousel Slack alerts for nightly Maestro failures (#11645)

This commit is contained in:
Samuel Newman
2026-09-04 17:20:26 +03:00
committed by GitHub
parent a197340bce
commit 4296e4aafd
8 changed files with 1196 additions and 110 deletions
+150 -6
View File
@@ -411,14 +411,158 @@ jobs:
--run-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
--commit-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" \
> e2e-summary.json
echo "notify=$(jq -r .notify e2e-summary.json)" >> "$GITHUB_OUTPUT"
echo "payload=$(jq -c .payload e2e-summary.json)" >> "$GITHUB_OUTPUT"
{
echo "notify=$(jq -r .notify e2e-summary.json)"
echo "failure_count=$(jq -r .failureCount e2e-summary.json)"
echo "screenshot_count=$(jq -r .screenshotCount e2e-summary.json)"
} >> "$GITHUB_OUTPUT"
jq .uploadPayload e2e-summary.json > slack-screenshot-upload.json
jq -r .githubSummary e2e-summary.json >> "$GITHUB_STEP_SUMMARY"
- name: 🔔 Notify Slack of E2E failures
- name: 📦 Set up pnpm for Slack screenshot framing
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.screenshot_count != '0'
continue-on-error: true
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: 🔧 Set up Node for Slack screenshot framing
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.screenshot_count != '0'
continue-on-error: true
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: package.json
cache: pnpm
- name: 📦 Install Slack screenshot framing dependencies
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.screenshot_count != '0'
continue-on-error: true
run: pnpm install --frozen-lockfile
- name: 🖼️ Frame failure screenshots for Slack cards
id: frame_screenshots
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.screenshot_count != '0'
continue-on-error: true
run: |
node .github/scripts/frame-slack-screenshots.mjs \
slack-screenshot-upload.json \
slack-screenshot-upload-framed.json \
slack-screenshots
- name: 📝 Build Slack message
if: steps.summary.outputs.notify == 'true'
env:
ANDROID_STATUS: ${{ needs.android.result }}
IOS_STATUS: ${{ needs.ios.result }}
SLACK_CHANNEL_ID: ${{ secrets.E2E_FAILURES_SLACK_CHANNEL_ID }}
run: |
node .github/scripts/summarize-maestro.mjs \
--ios-status "$IOS_STATUS" \
--android-status "$ANDROID_STATUS" \
--ios-root downloaded-artifacts/ios \
--android-root downloaded-artifacts/android \
--artifact-urls artifact-links.json \
--sha "$GITHUB_SHA" \
--run-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
--commit-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" \
> e2e-summary-for-slack.json
jq --arg channel "$SLACK_CHANNEL_ID" \
'.payload + {channel: $channel, unfurl_links: false, unfurl_media: false}' \
e2e-summary-for-slack.json > slack-message.json
- name: 🔔 Notify Slack of E2E result
id: notify_slack
if: steps.summary.outputs.notify == 'true'
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
webhook: ${{ secrets.E2E_FAILURES_SLACK_WEBHOOK }}
webhook-type: incoming-webhook
payload: ${{ steps.summary.outputs.payload }}
method: chat.postMessage
token: ${{ secrets.E2E_FAILURES_SLACK_BOT_TOKEN }}
payload-file-path: slack-message.json
errors: true
- name: 🧵 Prepare Slack thread payloads
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.failure_count != '0'
env:
FRAMING_OUTCOME: ${{ steps.frame_screenshots.outcome }}
SLACK_CHANNEL_ID: ${{ secrets.E2E_FAILURES_SLACK_CHANNEL_ID }}
SLACK_THREAD_TS: ${{ steps.notify_slack.outputs.ts }}
run: |
upload_payload=slack-screenshot-upload.json
if [ "$FRAMING_OUTCOME" = "success" ]; then
upload_payload=slack-screenshot-upload-framed.json
fi
jq --arg channel "$SLACK_CHANNEL_ID" --arg thread_ts "$SLACK_THREAD_TS" \
'.threadPayload + {channel: $channel, thread_ts: $thread_ts, unfurl_links: false, unfurl_media: false}' \
e2e-summary-for-slack.json > slack-thread-details.json
jq --arg channel_id "$SLACK_CHANNEL_ID" --arg thread_ts "$SLACK_THREAD_TS" \
'. + {channel_id: $channel_id, thread_ts: $thread_ts}' \
"$upload_payload" > slack-screenshot-upload-thread.json
- name: 🧾 Post all failure details to Slack thread
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.failure_count != '0'
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
method: chat.postMessage
token: ${{ secrets.E2E_FAILURES_SLACK_BOT_TOKEN }}
payload-file-path: slack-thread-details.json
errors: true
- name: 🖼️ Upload failure screenshots to Slack thread
id: upload_screenshots
if: >-
steps.summary.outputs.notify == 'true' &&
steps.summary.outputs.screenshot_count != '0'
continue-on-error: true
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
method: files.uploadV2
token: ${{ secrets.E2E_FAILURES_SLACK_BOT_TOKEN }}
payload-file-path: slack-screenshot-upload-thread.json
errors: true
- name: ⏳ Wait for Slack to process failure screenshots
if: steps.upload_screenshots.outcome == 'success'
run: sleep 5
- name: 📝 Build Slack message with screenshots
if: steps.upload_screenshots.outcome == 'success'
env:
ANDROID_STATUS: ${{ needs.android.result }}
IOS_STATUS: ${{ needs.ios.result }}
SLACK_CHANNEL_ID: ${{ secrets.E2E_FAILURES_SLACK_CHANNEL_ID }}
SLACK_THREAD_TS: ${{ steps.notify_slack.outputs.ts }}
SLACK_UPLOAD_RESPONSE: ${{ steps.upload_screenshots.outputs.response }}
run: |
node .github/scripts/summarize-maestro.mjs \
--ios-status "$IOS_STATUS" \
--android-status "$ANDROID_STATUS" \
--ios-root downloaded-artifacts/ios \
--android-root downloaded-artifacts/android \
--artifact-urls artifact-links.json \
--sha "$GITHUB_SHA" \
--run-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
--commit-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" \
--slack-upload-response "$SLACK_UPLOAD_RESPONSE" \
> e2e-summary-with-slack-files.json
jq --arg channel "$SLACK_CHANNEL_ID" --arg ts "$SLACK_THREAD_TS" \
'.payload + {channel: $channel, ts: $ts, unfurl_links: false, unfurl_media: false}' \
e2e-summary-with-slack-files.json > slack-message-update.json
- name: 🔄 Add screenshots to Slack message
if: steps.upload_screenshots.outcome == 'success'
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
method: chat.update
token: ${{ secrets.E2E_FAILURES_SLACK_BOT_TOKEN }}
payload-file-path: slack-message-update.json
errors: true