Skip to content

Fix grid rearrange bugs #3486

Fix grid rearrange bugs

Fix grid rearrange bugs #3486

name: Discord Integration - PR Closed
on:
pull_request:
types: [closed]
permissions:
actions: none
checks: none
contents: none
deployments: none
id-token: none
issues: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
jobs:
post-to-discord:
name: Post Notification To Discord
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Build Merged Args
if: ${{ github.event.pull_request.merged }}
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
SENDER_NAME: ${{ github.event.sender.login }}
run: |
echo "TITLE=Merged #$PR_NUMBER $PR_TITLE" >> $GITHUB_ENV
echo "COLOR=7291585" >> $GITHUB_ENV
echo "MESSAGE_ARGS=PR merged by $SENDER_NAME" >> $GITHUB_ENV
- name: Build Closed Args
if: ${{ !github.event.pull_request.merged }}
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
SENDER_NAME: ${{ github.event.sender.login }}
run: |
echo "TITLE=Closed (Without Merge) #$PR_NUMBER $PR_TITLE" >> $GITHUB_ENV
echo "COLOR=13313073" >> $GITHUB_ENV
echo "MESSAGE_ARGS=PR closed by $SENDER_NAME" >> $GITHUB_ENV
- name: Build Embeds JSON
env:
TEMPLATE: >-
[{
"author": {
"name": $author_name,
"icon_url": $author_icon_url,
"url": $author_html_url
},
"title": $title,
"color": $color,
"url": $html_url,
"footer": {
"text": $repo_full_name
}
}]
AUTHOR: ${{ github.event.sender.login }}
AUTHOR_ICON_URL: ${{ github.event.sender.avatar_url }}
AUTHOR_HTML_URL: ${{ github.event.sender.html_url }}
HTML_URL: ${{ github.event.pull_request.html_url }}
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
run: |
echo "DISCORD_EMBEDS=$(jq -nc --arg author_name "$AUTHOR" --arg author_icon_url "$AUTHOR_ICON_URL" --arg author_html_url "$AUTHOR_HTML_URL" --arg title "$TITLE" --arg color "$COLOR" --arg html_url "$HTML_URL" --arg repo_full_name "$REPO_FULL_NAME" "$TEMPLATE")" >> $GITHUB_ENV
- name: Send Notification
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_PRS_WEBHOOK }}
DISCORD_USERNAME: 'GitHub'
DISCORD_AVATAR: https://octodex.github.com/images/inspectocat.jpg
with:
args: ${{ env.MESSAGE_ARGS }}