slack icon indicating copy to clipboard operation
slack copied to clipboard

No Slack notification for label based subscription when using GitHub CLI to create PR

Open kiba-d opened this issue 3 years ago • 5 comments

Describe the bug No Slack notification for label based subscription when using GitHub CLI to create PR

To Reproduce Steps to reproduce the behavior:

  1. /github subscribe owner/arepo +label:“some_label
  2. gh pr create -t "some title" -a "some_user" -l "some_label"
  3. No Slack notification
  4. gh pr close pr_id
  5. Slack notification received

Expected behavior I expect to see the Slack notification about the created PR.

Desktop (please complete the following information):

  • OS: macOS Monterey
  • Version 4.23.0

kiba-d avatar Dec 30 '21 13:12 kiba-d

I have similar problem with dependabot notifications. Label based filtering does not deliver them at all.

Mehonoshin avatar Jan 19 '22 14:01 Mehonoshin

Looks like this was already implemented: https://github.com/integrations/slack/pull/1252

kylechadha avatar Jan 26 '22 21:01 kylechadha

I am also experiencing this error!

Background information

I have set up subscriptions into a slack channel:

/github subscribe <origin/repository> +label:dependencies
/github unsubscribe <origin/repository> issues commits releases deployments

Such that I will receive notifications for pull requestes with the label dependencies only:

This channel will receive notifications from <origin/repository> for: pulls, +label:'dependencies'

Expected behavior

Receive notifications for dependabot pull requests when they are opened or closed

Actual behavior

I receive notifications when a dependabot-pr is closed, but there is no notification when the dependabot-pr is created.

After som exploring I think i know why. The label dependencies is added to the pull request after the pull request is created. Since the subscription only provides notification when a pull request with this label is created (or closed), it will not post a notification.

Feature request

Change the behavior such that notifications are triggered also when the specified label is added to or removed from the pull request

glemvik avatar Mar 14 '22 11:03 glemvik

I think it's an issue with Github CLI/API, not with the Slack integration

We use hub (it's a wrapper around Github API) and we see that labels are applied a few seconds after PR is created, I even opened a bug for hub but I believe they can't do anything about it

Totally support @glemvik 's request to trigger a notification when label is added

aaleksandrov avatar Apr 15 '22 10:04 aaleksandrov

I also have this issue, but I'm creating a PR through PyGithub package. It uses the Github API under the hood, which doesn't accept labels when creating a PR. I'm adding the labels right after, but it doesn't trigger the notification.

The easiest solution seems to be changing the Slack integration so it triggers the notifications on label added event too. Another would be to make the API request accept the labels, so newly created PRs already have the labels. Then make the change in Github CLI and other clients.

virzen avatar Jun 06 '22 09:06 virzen