-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,74 +40,20 @@ jobs: | |
notify_slack: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Post to a Slack channel | ||
id: slack | ||
- name: Set Slack message payload | ||
id: set_payload | ||
run: | | ||
if [ "${{ inputs.status }}" == "success" ]; then | ||
echo "::set-output name=payload::{\"text\":\"GitHub Action build result: success\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":white_check_mark: *Workflow Succeeded*\"}},{\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Actor:*\n${{ inputs.actor }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Repository:*\n${{ inputs.repository }}\"},{\"type\":\"mrkdwn\",\"text\":\"*PR Title:*\n${{ inputs.pr_title }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Branch:*\n${{ inputs.branch }}\"}]},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*View Run:* <https://github.com/${{ inputs.repository }}/actions/runs/${{ inputs.run_id }}|View Details>\"}}]}" | ||
else | ||
echo "::set-output name=payload::{\"text\":\"GitHub Action build result: failure\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":x: *Workflow Failed*\"}},{\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Actor:*\n${{ inputs.actor }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Repository:*\n${{ inputs.repository }}\"},{\"type\":\"mrkdwn\",\"text\":\"*PR Title:*\n${{ inputs.pr_title }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Branch:*\n${{ inputs.branch }}\"}]},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Failed Step:* <https://github.com/${{ inputs.repository }}/actions/runs/${{ inputs.run_id }}|View Details>\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Test Failure Details:* \n${{ inputs.failures }}\"}}]}" | ||
fi | ||
shell: bash | ||
|
||
- name: Post to Slack | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: 'team-gnark-build' | ||
payload: | | ||
{ | ||
"text": "GitHub Action Notification", | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "GitHub Action Notification", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Status:*\n${{ inputs.status }}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Branch:*\n${{ inputs.branch }}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Actor:*\n${{ inputs.actor }}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Repository:*\n${{ inputs.repository }}" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*PR Title:*\n${{ inputs.pr_title || 'N/A' }}" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Run ID:*\n${{ inputs.run_id }}" | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Failures:*\n${{ inputs.failures || 'None' }}" | ||
} | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "View details: <${{ github.event.pull_request.html_url || github.event.head_commit.url }}|Click here>" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
payload: ${{ steps.set_payload.outputs.payload }} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |