Skip to content

Commit

Permalink
Improve CI Discord notification
Browse files Browse the repository at this point in the history
Remove "author" and add a short description of what triggered the CI run
  • Loading branch information
hrutvik committed Aug 13, 2024
1 parent 2b3d9d0 commit 0d1f1af
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/pure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,27 @@ jobs:
curl --silent --show-error --request POST
--header "Content-type: application/json;charset=utf-8"
--data '{"embeds": [{
"title": "CI #${{ github.run_number }}",
"description": "${{ needs.build.result == 'success' && 'Passed' || 'Failed' }}",
"title": "PureCake CI #${{ github.run_number }}: ${{ needs.build.result }}",
"description": "${{ env.DESCRIPTION }}",
"url": "https://github.com/CakeML/pure/actions/runs/${{ github.run_id }}",
"color": ${{ needs.build.result == 'success' && 8311585 || 13632027 }},
"author": {
"name": "PureCake CI",
"url": "https://github.com/CakeML/pure/actions/workflows/pure.yml"},
"fields": [
{"name": "HOL commit", "inline": true,
"value": "[${{ needs.build.outputs.hol_short_sha }}](https://github.com/HOL-Theorem-Prover/HOL/commit/${{ needs.build.outputs.hol_sha }})"},
{"name": "CakeML commit", "inline": true,
"value": "[${{ needs.build.outputs.cakeml_short_sha }}](https://github.com/CakeML/cakeml/commit/${{ needs.build.outputs.cakeml_sha }})"}]
}]}'
${{ secrets.DISCORD_WEBHOOK }}
env:
DESCRIPTION: |-
${{
github.event_name == 'workflow_dispatch' &&
format('Manually triggered by {0}', github.event.sender.login)
|| github.event_name == 'pull_request' &&
format('[Pull request #{0}](https://github.com/CakeML/pure/pull/{0})', github.event.number)
|| github.event_name == 'push' &&
format('Push by {0}', github.event.pusher.username || github.event.pusher.name)
|| github.event_name == 'schedule' &&
'Weekly scheduled run'
|| 'Unknown trigger'
}}

0 comments on commit 0d1f1af

Please sign in to comment.