pr_notification.yml 3.0 KB

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