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 9361747 commit c7d1422
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,12 @@ jobs:
notify_slack:
runs-on: ubuntu-latest
steps:
- name: Set Slack message payload
id: set_payload
- name: Post to Slack
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>\"}}]}"
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 }}\"}}]}"
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: ${{ steps.set_payload.outputs.payload }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
curl -X POST -H 'Content-type: application/json; charset=utf-8' --data "$payload" https://slack.com/api/chat.postMessage -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}"
shell: bash

0 comments on commit c7d1422

Please sign in to comment.