pr_notification.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.number }}"
  12. echo "Author: ${{ github.event.pull_request.user.login }}"
  13. - name: Google Chat Notification
  14. shell: bash
  15. env:
  16. TITLE: ${{ github.event.pull_request.title }}
  17. LABELS: ${{ join(github.event.pull_request.labels.*.name, ', ') }}
  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": "Pull request notification",
  26. "subtitle": "Pull request: #${{ github.event.pull_request.number }}"
  27. },
  28. "sections": [
  29. {
  30. "widgets": [
  31. {
  32. "keyValue": {
  33. "topLabel": "Repo",
  34. "content": "${{ github.event.pull_request.head.repo.full_name }}"
  35. }
  36. },
  37. {
  38. "keyValue": {
  39. "topLabel": "Title",
  40. "content": "'"$TITLE"'"
  41. }
  42. },
  43. {
  44. "keyValue": {
  45. "topLabel": "Creator",
  46. "content": "${{ github.event.pull_request.user.login }}"
  47. }
  48. },
  49. {
  50. "keyValue": {
  51. "topLabel": "State",
  52. "content": "${{ github.event.pull_request.state }}"
  53. }
  54. },
  55. {
  56. "keyValue": {
  57. "topLabel": "Assignees",
  58. "content": "- ${{ join(github.event.pull_request.assignees.*.login, ', ') }}"
  59. }
  60. },
  61. {
  62. "keyValue": {
  63. "topLabel": "Reviewers",
  64. "content": "- ${{ join(github.event.pull_request.requested_reviewers.*.login, ', ') }}"
  65. }
  66. },
  67. {
  68. "keyValue": {
  69. "topLabel": "Labels",
  70. "content": "- '"$LABELS"'"
  71. }
  72. },
  73. {
  74. "buttons": [
  75. {
  76. "textButton": {
  77. "text": "Open Pull Request",
  78. "onClick": {
  79. "openLink": {
  80. "url": "${{ github.event.pull_request.html_url }}"
  81. }
  82. }
  83. }
  84. }
  85. ]
  86. }
  87. ]
  88. }
  89. ]
  90. }
  91. ]
  92. }'