push_notification.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. name: GSI Push Main Notification
  2. on:
  3. push:
  4. branches:
  5. - main
  6. jobs:
  7. notify-push-main:
  8. runs-on: ubuntu-latest
  9. env:
  10. COMMIT: ${{ github.event.head_commit.message }}
  11. steps:
  12. - name: Main Branch Push
  13. run: |
  14. echo "Workflow initiated by event with name: ${{ github.event_name }}"
  15. echo "Pushing commit to main: ${{ github.event.head_commit.id }}"
  16. echo "Pushed by: ${{ github.event.pusher.name }}"
  17. - name: Push Notification to Google Chat
  18. run: |
  19. curl --location --request POST '${{ secrets.WEBHOOK_URL }}' \
  20. --header 'Content-Type: application/json' \
  21. --data-raw '{
  22. "cards": [
  23. {
  24. "header": {
  25. "title": "Push to main branch",
  26. "subtitle": "$COMMIT"
  27. },
  28. "sections": [
  29. {
  30. "widgets": [
  31. {
  32. "keyValue": {
  33. "topLabel": "Repo",
  34. "content": "${{ github.event.repository.full_name }}"
  35. }
  36. },
  37. {
  38. "keyValue": {
  39. "topLabel": "Committed by",
  40. "content": "${{ github.event.head_commit.author.username }}"
  41. }
  42. },
  43. {
  44. "buttons": [
  45. {
  46. "textButton": {
  47. "text": "Ref comparison",
  48. "onClick": {
  49. "openLink": {
  50. "url": "${{ github.event.compare }}"
  51. }
  52. }
  53. }
  54. }
  55. ]
  56. }
  57. ]
  58. }
  59. ]
  60. }
  61. ]
  62. }'