Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/discord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [closed]
types: [closed, opened]
Comment thread
Shobhit-Nagpal marked this conversation as resolved.
branches:
- master
issues:
Expand All @@ -14,16 +14,23 @@ on:
jobs:
notify:
runs-on: ubuntu-latest
# For PRs, only run if it was actually merged (not just closed)
if: |
github.event_name == 'push' ||
github.event_name == 'issues' ||
(github.event_name == 'pull_request' && github.event.pull_request.merged == true)
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
(github.event_name == 'pull_request' && github.event.action == 'opened')
steps:
- name: Send to Discord
run: |
if [ "${{ github.event_name }}" == "pull_request" ] && [ "${{ github.event.action }}" == "opened" ]; then
MESSAGE="PR Opened\nPR: ${{ github.event.pull_request.html_url }}\nTitle: ${{ github.event.pull_request.title }}\nRaised by: ${{ github.event.pull_request.user.login }}"
Comment thread
Shobhit-Nagpal marked this conversation as resolved.
elif [ "${{ github.event_name }}" == "pull_request" ] && [ "${{ github.event.action }}" == "closed" ]; then
MESSAGE="PR Merged\nPR: ${{ github.event.pull_request.html_url }}\nTitle: ${{ github.event.pull_request.title }}\nRaised by: ${{ github.event.pull_request.user.login }}\nMerged by: ${{ github.event.pull_request.merged_by.login }}"
elif [ "${{ github.event_name }}" == "issues" ]; then
MESSAGE="New Issue\nIssue: ${{ github.event.issue.html_url }}\nTitle: ${{ github.event.issue.title }}\nRaised by: ${{ github.actor }}"
else
MESSAGE="Push to master\nPushed by: ${{ github.actor }}\nAuthor: ${{ github.event.head_commit.author.name }}\nCommit: ${{ github.event.head_commit.message }}"
fi
curl -H "Content-Type: application/json" \
-d "{
\"content\": \"Repo update in ${{ github.repository }}\nEvent: ${{ github.event_name }}\nUser: ${{ github.actor }}\nBranch: ${{ github.ref_name }}\"
}" \
-d "{\"content\": \"<@&${{ secrets.DISCORD_ATOMIC_ROLE_ID }}> $MESSAGE\"}" \
${{ secrets.DISCORD_WEBHOOK }}
Loading