notification.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: GSI Chatroom PR Notification
  2. on:
  3. pull_request:
  4. types: [assigned, opened, ready_for_review, reopened, review_requested]
  5. push:
  6. branches:
  7. - main
  8. jobs:
  9. notify:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Pull Request Details
  13. run: |
  14. echo "Pull Request: ${{ github.event.pull_request.title }}"
  15. echo "Author: ${{ github.event.pull_request.user.login }}"
  16. - name: Google Chat Notification
  17. run: |
  18. curl --location --request POST '${{ secrets.WEBHOOK_URL }}' \
  19. --header 'Content-Type: application/json' \
  20. --data-raw '{
  21. "cards": [
  22. {
  23. "header": {
  24. "title": "Pull request notification",
  25. "subtitle": "Pull request: #${{ github.event.pull_request.number }}"
  26. },
  27. "sections": [
  28. {
  29. "widgets": [
  30. {
  31. "keyValue": {
  32. "topLabel": "Repo",
  33. "content": "${{ github.event.pull_request.head.repo.full_name }}"
  34. }
  35. },
  36. {
  37. "keyValue": {
  38. "topLabel": "Title",
  39. "content": "${{ github.event.pull_request.title }}"
  40. }
  41. },
  42. {
  43. "keyValue": {
  44. "topLabel": "Creator",
  45. "content": "${{ github.event.pull_request.user.login }}"
  46. }
  47. },
  48. {
  49. "keyValue": {
  50. "topLabel": "State",
  51. "content": "${{ github.event.pull_request.state }}"
  52. }
  53. },
  54. {
  55. "keyValue": {
  56. "topLabel": "Assignees",
  57. "content": "- ${{ join(github.event.pull_request.assignees.*.login, ', ') }}"
  58. }
  59. },
  60. {
  61. "keyValue": {
  62. "topLabel": "Reviewers",
  63. "content": "- ${{ join(github.event.pull_request.requested_reviewers.*.login, ', ') }}"
  64. }
  65. },
  66. {
  67. "keyValue": {
  68. "topLabel": "Labels",
  69. "content": "- ${{ join(github.event.pull_request.labels.*.name, ', ') }}"
  70. }
  71. },
  72. {
  73. "buttons": [
  74. {
  75. "textButton": {
  76. "text": "Open Pull Request",
  77. "onClick": {
  78. "openLink": {
  79. "url": "${{ github.event.pull_request.html_url }}"
  80. }
  81. }
  82. }
  83. }
  84. ]
  85. }
  86. ]
  87. }
  88. ]
  89. }
  90. ]
  91. }'