Add repo filters to subscribe command for entire organization
@gimenete when I subscribe to the whole organisation, and then try to unsubscribe from a specific repo, I get an error saying I'm not subscribed to those repos.
/github subscribe Org-name
/github unsubscribe Org-name/repo
You're not currently subscribed to
Org-name/repoUse/github subscribe Org-name/repoto subscribe.
It happens with multiple repos in the org. I am not even sure from these errors whether I'm subscribed to any of the repos in the org. When I try:
/github subscribe list
I get:
Subscribed to the following accounts Org-name
And the only repos listed as subscribed are the ones I've listed manually. I am trying to subscribe to the whole org to catch newly created repos, and exclude non-dev repos.
Originally posted by @Jessicawatsonmiller in https://github.com/integrations/slack/issues/391#issuecomment-433257461
For orgs with a large number of repos, it is convenient to subscribe to the entire organization. That being said, there may be a number of reasons to exclude a few repositories. It would be great if something like the following command worked:
/github subscribe Org-name omit:"noisy-repo"
This would be a killer feature. I recently asked about it here https://github.com/integrations/slack/discussions/1842 but received no replies. Now I see it's not supported yet based on this ticket and #391.
Please make this work, Github, it's such an important missing feature.
This is killing us too. I don't want to have to manually subscribe a channel to 100 repos to exclude one noisy one.
I put together an AppleScript to do the resubscribing for me.
First I needed a list of repositories which I got via the GitHub CLI:
gh repo list my_organization --json nameWithOwner --jq .[].nameWithOwner --limit 1000 --no-archived
Then I copied and pasted the output into a text editor where I could quickly prepend and append each line with the text for the GitHub bot in Slack (this could have been done in the shell and included in the output as well if I wanted to think about it more):
/github subscribe my_organization/repository1 workflows reviews comments branches commits:* discussions
/github subscribe my_organization/repository2 workflows reviews comments branches commits:* discussions
/github subscribe my_organization/repositoryETC workflows reviews comments branches commits:* discussions
Finally I ran the AppleScript through Automator on macOS to do the copy and paste between TextEdit (or anything else) and Slack:
repeat 315 times
tell application "TextEdit" to activate
tell application "System Events"
tell process "TextEdit"
key code 124 using {shift down, command down}
keystroke "c" using command down
key code 123 using command down
key code 125
end tell
end tell
delay 1
tell application "Slack" to activate
tell application "System Events"
tell process "Slack"
keystroke "v" using command down
delay 1
keystroke return
end tell
end tell
delay 5
end repeat
The key codes represent arrow keys. 124: right arrow, 123: left arrow, 125: down arrow.
Also, I created a notifier that will post new repositories to our Slack channel so that we remember to subscribe them: https://github.com/caltechlibrary/congenial-octo-machine
Another possible variation of this that would be really useful would be to subscribe to all repos in an org that match a topic... we label our repos by project using the topic command and we can then list them all via:
gh repo list ORG_NAME --topic PROJECT_TOPIC --no-archived
So... I've love to be able to do something like this to subscribe to those in a channel:
/github subscribe ORG_NAME topic:PROJECT_TOPIC
We have this issue also, with 119 repos we can't subscribe to each one individually but we have certain private repos which should not be reporting into our public Slack notifications channel. It's quite important that there's the ability to filter such repos out while also being able to globally subscribe to all repos in an org.