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 26f9407 commit 1e6bff0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ jobs:
uses: ./.github/workflows/slack-notifications.yml
needs:
- test
- staticcheck
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
status: ${{ needs.test.result }}
status: ${{ needs.staticcheck.result }}${{ needs.test.result }}
actor: ${{ github.actor }}
repository: ${{ github.repository }}
branch: ${{ github.event.pull_request.head.ref }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ jobs:
slack-notifications:
if: always()
uses: ./.github/workflows/slack-notifications.yml
needs:
- test
uses: ./.github/workflows/slack-notifications.yml
- staticcheck
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
status: ${{ needs.test.result }}
status: ${{ needs.staticcheck.result }}${{ needs.test.result }}
actor: ${{ github.actor }}
repository: ${{ github.repository }}
branch: ${{ github.event.pull_request.head.ref }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
steps:
- name: Post to Slack
run: |
if [ "${{ inputs.status }}" == "success" ]; then
payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: success\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":green_circle: ${{ inputs.repository }} *${{ inputs.branch }}*\"}},{\"type\":\"context\",\"elements\":[{\"type\":\"plain_text\",\"text\":\"Author: ${{ inputs.actor }}\",\"emoji\":true}]}]}"
if [ "${{ inputs.status }}" == "successsuccess" ]; then
payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: success\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":large_green_circle: ${{ inputs.repository }} *${{ inputs.branch }}*\"}},{\"type\":\"context\",\"elements\":[{\"type\":\"plain_text\",\"text\":\"${{ inputs.actor }}\",\"emoji\":true}]}]}"
else
payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: failure\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":red_circle: ${{ inputs.repository }} *${{ 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:* ${{ inputs.failures }}\"}},{\"type\":\"context\",\"elements\":[{\"type\":\"plain_text\",\"text\":\"Author: ${{ inputs.actor }}\",\"emoji\":true}]}]}"
payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: failure\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":red_circle: ${{ inputs.repository }} *${{ 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:* ${{ inputs.failures }}\"}},{\"type\":\"context\",\"elements\":[{\"type\":\"plain_text\",\"text\":\"${{ inputs.actor }}\",\"emoji\":true}]}]}"
fi
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 1e6bff0

Please sign in to comment.