heffnt commited on
Commit
a050b4b
·
1 Parent(s): 7c95717

Enhance Discord notification workflow to support additional event types, including workflow completions, and improve message formatting for workflow run events.

Browse files
.github/workflows/discord-notification.yml CHANGED
@@ -7,6 +7,12 @@ on:
7
  release:
8
  create:
9
  delete:
 
 
 
 
 
 
10
 
11
  jobs:
12
  notify:
@@ -38,6 +44,23 @@ jobs:
38
  delete)
39
  MESSAGE="Deleted ${{ github.event.ref_type }} ${{ github.event.ref }} by $GITHUB_ACTOR"
40
  ;;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  *)
42
  MESSAGE="Event $EVENT_NAME by $GITHUB_ACTOR on ${{ github.repository }} at ${{ github.ref_name }}"
43
  ;;
 
7
  release:
8
  create:
9
  delete:
10
+ workflow_run:
11
+ workflows:
12
+ - "Sync to Hugging Face hub"
13
+ - "Run chatbot test"
14
+ types:
15
+ - completed
16
 
17
  jobs:
18
  notify:
 
44
  delete)
45
  MESSAGE="Deleted ${{ github.event.ref_type }} ${{ github.event.ref }} by $GITHUB_ACTOR"
46
  ;;
47
+ workflow_run)
48
+ NAME="${{ github.event.workflow_run.name }}"
49
+ CONCLUSION="${{ github.event.workflow_run.conclusion }}"
50
+ BRANCH="${{ github.event.workflow_run.head_branch }}"
51
+ SHA="${{ github.event.workflow_run.head_sha }}"
52
+
53
+ if [ "$CONCLUSION" = "success" ]; then
54
+ STATUS="PASSED"
55
+ elif [ "$CONCLUSION" = "failure" ]; then
56
+ STATUS="FAILED"
57
+ else
58
+ STATUS="$CONCLUSION"
59
+ fi
60
+
61
+ SHORT_SHA="${SHA:0:7}"
62
+ MESSAGE="Workflow $NAME $STATUS on $BRANCH (commit $SHORT_SHA)"
63
+ ;;
64
  *)
65
  MESSAGE="Event $EVENT_NAME by $GITHUB_ACTOR on ${{ github.repository }} at ${{ github.ref_name }}"
66
  ;;