forked from AOT-Technologies/forms-flow-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AOT-Technologies#2310 from AOT-Technologies/pr-not…
…ification-updated Update pr-notification.yml
- Loading branch information
Showing
1 changed file
with
53 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: PR Notification to Google Chat | |
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
types: [opened, synchronize, closed] | ||
branches: | ||
- develop | ||
|
||
|
@@ -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 }}" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}' | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |