Skip to content

Commit

Permalink
Merge pull request AOT-Technologies#2310 from AOT-Technologies/pr-not…
Browse files Browse the repository at this point in the history
…ification-updated

Update pr-notification.yml
  • Loading branch information
arun-s-aot authored Oct 28, 2024
2 parents 9b0cb72 + 528c495 commit ee9a668
Showing 1 changed file with 53 additions and 34 deletions.
87 changes: 53 additions & 34 deletions .github/workflows/pr-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR Notification to Google Chat

on:
pull_request:
types: [opened, synchronize]
types: [opened, synchronize, closed]
branches:
- develop

Expand All @@ -12,45 +12,64 @@ jobs:
if: github.repository == 'AOT-Technologies/forms-flow-ai'

steps:
- name: Determine PR Status
id: pr_status
run: |
if [[ "${{ github.event.action }}" == "opened" ]]; then
echo "status=🟢 Open" >> $GITHUB_ENV
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
echo "status=🟣 Merged" >> $GITHUB_ENV
elif [[ "${{ github.event.action }}" == "closed" ]]; then
echo "status=🔴 Closed" >> $GITHUB_ENV
else
echo "status=🟢 Open" >> $GITHUB_ENV
fi
- name: Send notification to Google Chat
uses: fjogeleit/[email protected]
with:
url: ${{ secrets.WEBHOOK }}
method: POST
contentType: application/json
data: '{
"cards": [
{
"header": {
"title": "Open Source : Pull Request Opened by ${{ github.event.pull_request.user.login }}",
"subtitle": "Pull Request #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}",
"imageUrl": "${{ github.event.pull_request.user.avatar_url }}"
},
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "Repository: ${{ github.repository }}"
}
},
{
"buttons": [
{
"textButton": {
"text": "View Pull Request",
"onClick": {
"openLink": {
"url": "${{ github.event.pull_request.html_url }}"
data: |
{
"cards": [
{
"header": {
"title": "Open source: Pull Request Opened by ${{ github.event.pull_request.user.login }}",
"subtitle": "Pull Request #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}",
"imageUrl": "${{ github.event.pull_request.user.avatar_url }}"
},
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "Repository: ${{ github.repository }}"
}
},
{
"textParagraph": {
"text": "Status: ${{ env.status }}"
}
},
{
"buttons": [
{
"textButton": {
"text": "View Pull Request",
"onClick": {
"openLink": {
"url": "${{ github.event.pull_request.html_url }}"
}
}
}
}
}
]
}
]
}
]
}
]
}'
]
}
]
}
]
}
]
}

0 comments on commit ee9a668

Please sign in to comment.