Skip to content

About

Your GitHub notifications as Slack DMs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

github-slack-notifications

Everything on GitHub that concerns you, as Slack DMs from an app that can only post: reviews and comments on your pull requests, bot reviews like Greptile's, CI results including commit statuses like Vercel's, review requests, mentions, replies, merges, conflicts, a heads-up when your pull request is ready to merge, and a daily list of what's waiting on your review. Each one is a card with a colored bar: the title, linked on its number, what happened, the whole comment or the failing checks, then the branch.

#7 Add the widget
:speech_balloon: greptile-apps reviewed `widget.py:210` and 2 more comments
P1 Branches control the same cluster across worktrees

Record which worktree owns each cluster before pruning.
add-widget into main

How it works

It doesn't rely on GitHub deciding to notify you. Every minute it finds the pull requests and issues that concern you (yours, ones waiting on your review, ones you've reviewed, and anything that involves you) and reads what's new on their timelines, along with each pull request's checks, commit statuses and merge state. On your pull requests, and ones you're reviewing, GitHub's event subscriptions push reviews, CI results, pushes, conflicts and merges the moment they happen, so those arrive in seconds. Your notification inbox fills in releases, workflow failures off your pull requests and anything else GitHub sends.

GitHub goes down often, so it treats that as routine: brief failures are retried on the spot, rate limits are waited out, and during an outage it checks every few seconds and catches up on everything the moment GitHub answers. Posts wait in a saved outbox until Slack takes them, so neither outage nor restart loses or reorders one, and nothing is posted twice. The first run records what already exists without posting it. If GitHub stays down for 15 minutes it says so in Slack, and again once it's back.

Nothing is posted until you list the kinds you want in NOTIFY, and only what those kinds need is fetched from GitHub. Kinds added in later releases stay off until you add them too.

Kind Posted as
comment, review_comment, review_reply 💬 kim commented, kim reviewed widget.py:3, kim replied, with the whole comment
reacted 👍 ❤️ kim and lee reacted to your comment, on anything of yours, quoting it
resolved, unresolved ☑️ greptile-apps resolved their comment widget.py:3, on your pull requests and threads you started
approved, changes_requested, review_dismissed ✅ kim approved, ⚠️ kim requested changes, 🗑️ kim dismissed a review
review_requested, assigned, mentioned 👀 kim requested your review (or your team's), 👉 kim assigned you, 📣 kim mentioned you
merged, closed, reopened, ready_for_review, converted_to_draft 🔀 kim merged it, and so on
renamed, base_changed, force_pushed, edited Others changing your pull request, like ✏️ greptile-apps edited the description
pushed ⬆️ New commits since your review, on pull requests you've reviewed
committed ⬆️ kim pushed 2 commits, listing them, when someone else pushes to your pull request
ci_failed, ci_running, ci_passed 🔴 CI failed, listing the failing checks, then 2 of 15 checks failed on abc1234, on your pull requests when the result changes
merge_conflict, ready_to_merge 💥 Merge conflict with the base branch, 🎉 Ready to merge, once per head commit
added_to_merge_queue, removed_from_merge_queue, auto_merge_enabled, auto_merge_disabled ⛔ Removed from the merge queue, with GitHub's reason, and the rest, on your pull requests
review_request_removed, unassigned Strikes out the review request or assignment they take back, instead of posting
review_digest 👀 3 pull requests waiting on your review, daily
release, other 🚀 Released, 🔔 and anything else from your inbox

Your own activity is never posted. Neither is vercel[bot]'s activity, or reactions from apps, unless you unmute them.

Setup

  1. GitHub token: a classic personal access token with the notifications, repo and read:org scopes, or the one the GitHub CLI holds (gh auth token). The notifications API doesn't take fine-grained tokens.
  2. Slack app: create one at https://api.slack.com/apps from slack-app-manifest.yml, install it, and copy its bot token (xoxb-...). The app can only post: it receives no events, has no commands, and nobody can message it. It refuses to start with a token that can do more.
  3. Where to post: your Slack member ID (U...) for DMs, or a channel ID with the app added to it.

Running it

services:
  github-slack-notifications:
    image: ghcr.io/macwilk/github-slack-notifier:latest
    restart: unless-stopped
    environment:
      GITHUB_TOKEN: ${GITHUB_TOKEN}
      SLACK_TOKEN: ${SLACK_TOKEN}
      SLACK_CHANNEL: U0123456789
      NOTIFY: '["comment", "review_comment", "review_reply", "approved", "changes_requested", "review_requested", "mentioned", "ci_failed", "ready_to_merge"]'
      DIGEST__TIMEZONE: America/New_York
    volumes:
      - data:/data

volumes:
  data:

--dry-run --lookback 24h prints what the last day would have posted, without posting or changing anything.

Settings

config.example.yml lists every setting with its default. Set them in the environment, with __ between nested keys and JSON for lists and maps, or in a config.yml: /data/config.yml in the container, otherwise ./config.yml, $XDG_CONFIG_HOME/github-slack-notifications/config.yml or --config path.

NOTIFY='["comment", "review_comment", "approved", "ci_failed", "reacted", "resolved"]'
MUTE__AUTHORS='["vercel[bot]", "dependabot[bot]"]'
IGNORE_CHECKS='{"acme/app": ["Spell check"]}'
DIGEST__TIME=08:30

Development

uv sync
uv run ruff format --check && uv run ruff check && uv run ty check && uv run pytest
GITHUB_TOKEN=$(gh auth token) SLACK_TOKEN=x SLACK_CHANNEL=x uv run github-slack-notifications --dry-run --lookback 24h

Releases: uv version --bump minor, commit, then push a v<version> tag. The release workflow checks the tag matches, publishes the image for amd64 and arm64 to ghcr.io/macwilk/github-slack-notifier, and creates the GitHub release.

License

AGPL-3.0

About

Your GitHub notifications as Slack DMs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages