Skip to content

Setting up the Webster Webhook for Discord

If you want it in video form: video

Note: the video also does go through a second way of doing it but we will follow the first way since we want the custom icon and name. Also, don't append the /github for the first step - mistake in the video (sorry Anton).

In Discord

  1. First, make a new discord channel under your project (name the channel pr or whatever you want).
  2. Go to settings for the newly created channel and go to integrations.
  3. Click on Create Webhook, name the new webhook "Webster", if you have the icon, change it to the Webster icon.
  4. Copy the webhook url.

In GitHub

  1. Go to the GitHub repository for your project
  2. Go to settings -> secrets and variables -> actions
  3. Make a new repository secret and call it DISCORD_WEBHOOK_URL

In the Repository

  1. Make a new workflow (file) under .github/workflows (call it notification.yml)
  2. Copy the code below into the file:

    notification.yml

    name: Pull Request Notifications
    
    on:
      pull_request:
        types: [opened, reopened, closed]
    
    jobs:
      pull_request_created:
        if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'reopened'
        runs-on: ubuntu-latest
        steps:
          - name: Discord Webhook Action
            uses: tsickert/discord-webhook@v5.3.0
            with:
              webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
              content: "Pull request opened: ${{ github.event.pull_request.title }} | Link: [View Pull Request](${{ github.event.pull_request.html_url }})"
    
      pull_request_merged:
        if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
        runs-on: ubuntu-latest
        steps:
          - name: Discord Webhook Action
            uses: tsickert/discord-webhook@v5.3.0
            with:
              webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
              content: "Pull request merged: ${{ github.event.pull_request.title }}"
    

  3. Commit and push the changes