push_notification.yml 1.9 KB

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