-
Notifications
You must be signed in to change notification settings - Fork 15
32 lines (29 loc) · 1.52 KB
/
discord.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Discord notification workflow
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
jobs:
discord:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: on-success
if: ${{ github.event.workflow_run.conclusion == 'success' }}
run: echo "STATUS_MESSAGE=Success 🎉" >> $GITHUB_ENV
- name: on-error
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
run: echo "STATUS_MESSAGE=Failure 💥" >> $GITHUB_ENV
- name: on-unknown
if: ${{ github.event.workflow_run.conclusion != 'success' && github.event.workflow_run.conclusion != 'failure' }}
run: echo "STATUS_MESSAGE=${{ github.event.workflow_run.conclusion }} ⁉️" >> $GITHUB_ENV
- name: map-commit-message
run: |
echo "COMMIT_MESSAGE=${{ github.event.workflow_run.head_commit.message }}" | head -n1 >> $GITHUB_ENV
- name: send-message
uses: Ilshidur/action-discord@master
with:
args: "Workflow run:\n- Status: ${{ env.STATUS_MESSAGE }}\n- Link to run: [${{ github.event.workflow_run.name }}](<${{ github.event.workflow_run.html_url }}>)\n- Link to commit: [${{ env.COMMIT_MESSAGE }}](<${{ github.event.workflow_run.repository.html_url }}/commit/${{ github.event.workflow_run.head_sha }}>)\n- Link to branch: [${{ github.event.workflow_run.head_branch }}](<${{ github.event.workflow_run.repository.html_url }}/tree/${{ github.event.workflow_run.head_branch }}>)"