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