Skip to content

Commit

Permalink
build: ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
gbotrel committed Sep 13, 2024
1 parent 4de199a commit 9361747
Showing 1 changed file with 13 additions and 67 deletions.
80 changes: 13 additions & 67 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 9361747

Please sign in to comment.