Lab notes · 3 min read

Filtering bot noise out of GitHub's Slack notifications

Armand Rego
// 23 Nov 2026

Dependabot opening and auto-merging pull requests across our repositories had buried human pull requests in the engineering Slack channel for several client projects. The GitHub app for Slack can't exclude bots: its only pull request filter is a single required label. It has no exclusions and no author filters.

Label the humans instead

If we can only include by label, we label the pull requests we *want*:

# bash
1
/github subscribe OWNER/REPO comments +label:"human"

A reusable workflow adds the label to every pull request that isn't opened by a bot:

# yaml
1
jobs:
2
  label:
3
    if: github.event.pull_request.user.type == 'User'
4
    runs-on: ubuntu-latest
5
    steps:
6
      - env:
7
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8
          PR_URL: ${{ github.event.pull_request.html_url }}
9
        run: |
10
          gh label create human --repo "$GITHUB_REPOSITORY" --color 0E8A16 --force
11
          gh pr edit "$PR_URL" --add-label human

The catch

The Slack app checks the filter on each event as it arrives. The `opened` event comes in before the label exists, so it's dropped, and adding a label doesn't trigger a notification. The pull request only shows up in Slack once something else happens, like a comment.

So the workflow has to trigger a follow-up event. Whatever that event is, it shows up as a reply under the pull request card, so we made it a useful one: a summary comment posted once per pull request.

# yaml
1
- env:
2
    GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3
    PR_URL: ${{ github.event.pull_request.html_url }}
4
    AUTHOR: ${{ github.event.pull_request.user.login }}
5
  run: |
6
    marker="<!-- label-human-summary -->"
7
    gh pr view "$PR_URL" --json comments --jq '.comments[].body' | grep -q "$marker" && exit 0
8
    gh pr comment "$PR_URL" --body "${marker}
9
    Opened by @${AUTHOR}"

Passing values through `env` avoids script injection. The @-mention also subscribes the author to the Slack thread.

Now the channel gets one card per human pull request, without the deluge of bot PRs and auto-merges!

At Weird Sheep Labs, we build production software for clients in engineering and the life sciences, and we continuously improve the developer tooling that keeps our team shipping along the way. If you've got a project in mind, get in touch!