Skip to content

Refactor ContextMenuWrapper #3941

Refactor ContextMenuWrapper

Refactor ContextMenuWrapper #3941

name: Discord Integration - Issue Comments
on:
issue_comment:
types: [created]
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 Comment To Discord
timeout-minutes: 5
runs-on: ubuntu-latest
if: ${{ !github.event.issue.pull_request }}
steps:
- name: Build Embeds JSON
env:
TEMPLATE: >-
[{
"author": {
"name": $author_name,
"icon_url": $author_icon_url,
"url": $author_html_url
},
"title": $title,
"color": 2369839,
"url": $html_url,
"description": $body,
"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 }}
TITLE: 'Comment on #${{ github.event.issue.number }} ${{ github.event.issue.title }}'
BODY: ${{ github.event.comment.body }}
HTML_URL: ${{ github.event.issue.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 html_url "$HTML_URL" --arg body "$BODY" --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_ISSUES_WEBHOOK }}
DISCORD_USERNAME: 'GitHub'
DISCORD_AVATAR: https://octodex.github.com/images/original.png
SENDER_NAME: ${{ github.event.sender.login }}
with:
args: 'New comment by ${{ env.SENDER_NAME }}'