integrations / slack

Bring your code to the conversations you care about with the GitHub and Slack integration
https://slack.github.com/
MIT License
2.98k stars 468 forks source link

Branch notifications include non-branch refs #1902

Open pkaminski opened 1 month ago

pkaminski commented 1 month ago

Describe the bug When notifications for branches are turned on, they report all refs created and deleted, not just branches. For example, if /refs/reviewable/pr216/r6 is deleted, the integration will post a notification that branch "pr216/r6 was deleted". However, only refs under /refs/heads are branches. (It's not clear if this affects both branch creations and deletions, or just deletions.)

To Reproduce

  1. Subscribe to branch notifications in Slack.
  2. Create a ref /refs/foo/bar in the repo.
  3. Delete the ref.
  4. A notification for "bar was deleted" is posted.

Expected behavior The integration should ignore ref mutations outside of /refs/heads (and possibly /refs/tags, if desired).

Screenshots image

Additional context Reviewable (https://reviewable.io) creates custom refs to pin certain commits in the repo, then deletes once they're no longer needed. This can make for a lot of noise in Slack if branch notifications are turned on.

There's a related feature request for filtering notifications by branch name that would also allow a workaround for this issue.