Github hook for milestone - github

I want to integrate github with a external service.
In particular I want certain actions to happen when an issue closes or a milestone is completed. I can see how to do the above for issues by adding a webhook against the issue event updates http://developer.github.com/v3/repos/hooks/.
However, I don't see any events around milestones.
Why is that? Is it an ommission? I have seen some integrations of github milestones with the google calendar - I am assuming that this requires webhooks (I wouldn't expect them to use polling against the milestone api).
One alternative I have thought if there is no such event, is to listen for issue events and every time an issue closes, check whether this issue is associated with a milestone, and if it is check whether all other issues associated with that milestone are already closed and then create my own "milestone completed" event. ( I don't need milestone create events).
Any suggestions would be greatly welcomed.

Yeah, there are no milestone events at this time. Your idea using issue events and checking the milestone closed issues count is probably the way I'd do it too. Remember to use conditional GETs when fetching the milestone info in order to reduce your API quota consumption.

There are now webhook events for milestones - introduced by Github in October 2016. See:
https://developer.github.com/changes/2016-10-27-new-label-and-milestone-webhooks/

Related

How to subscribe a slack channel to an individual github issue

I don't want to subscribe a slack channel to all issues on arbitrary third party repositories, just to the particular issues on which my team/organization is involved (contributing to / impacted by), so the usual github integration command /github subscribe thirdparty/arbitraryrepo issues does not suffice as it would cause a ton of unwanted noise in the channel. (and the existing label filtering would not cut it)
(Update: there is an open feature request for that https://github.com/integrations/slack/issues/1280)
I neither want to forward my personal github subscriptions to the slack channel as there are lots of projects I am individually involved that have nothing to do with my team's work. (e.g. my direct mentions)
Also, subscription should stay despite I leaved the team/company.
A per-issue public RSS/Atom feed would cut it but it does not exist.
Am I missing something obvious?
The only workaround I can think of is adding a channel email integration, registering that address to an organization-shared github account and subscribe it to the individual issues we run into.
But this is quite cumbersome (must keep an alternate github logged-in session while browsing, channel readability could be abused to hijack company account, subscriptions can't be managed from the slack channel...) so any different idea would be very welcome.
As far as I know there is nothing that would suit your need completely at this moment, but have you considered labels?
#1 option You could use filtering based on label which seems to be the closest:
That would notify you about all issues, pulls, commits, releases, deployments that has a given label. Syntax example:
/github subscribe repo-owner/repo-name +label:"team-a"
Pros: a general filter based on a label name, e.g. team-a
Cons:
a single label filter only (AFAIK: multiple labels aren't supported but discussed: https://github.com/integrations/slack/issues/384)
this works only for a label given when issue/PR is created. Not during its existence ("change label" events are not triggered). Known bug (https://github.com/integrations/slack/issues/1594) and feature PR is open https://github.com/integrations/slack/issues/965
Note: a workaround to get info about label change in PR: to convert PR to a draft and back (https://github.com/integrations/slack/issues/965#issuecomment-1330884166)
#2 option Another thing that might be considered is that the account that is used within GitHub Slack app for connecting to Git server will be actually notified also about all its mentions, assignments & reviews! So if you don't use your personal account, you could get generated some related notifications to the whole team / other specific user etc.
EDIT:
Workaround steps to achieve partially what you want (but it can be in some conflict with your Slack / GitHub settings that I’m not aware of):
Use / create a shared account (or other special account) in GitHub
In Slack, use this special GitHub account for connecting Slack GitHub app to GitHub (this enables notifications by default for this account - mentions and assignments).
Then, when this GitHub account is assigned / mentioned, you’d automatically get notified (but again, then it would work not just for issues but hypothetically also in PRs etc.) to a dedicated channel where you'd have your GitHub integration set.
To auto-assign an issue, you'd have to use e.g. GitHub Actions.
Caveat: But as we discuss, there’s no simple way to achieve your goal completely. To at least get closer to something similar to what you describe and require, you’d need to accept some compromises and extra steps for workaround as it’s unfortunately not currently natively supported. 3rd hypothetical way is to create even more complex mechanisms of filtering & redirecting data which would be increase a level of complexity to just introduce but also maintain (unless you'd already have something similar existing in your infrastructure) and I wouldn't recommend it.

How to search GitHub issues for the ones you're watching?

How can we search/filter GitHub issues for the ones you've previously marked as 'watching'?
I can't spot any way to do it via the GUI, but perhaps there's some search parameter?
I took a guess and tried watching:true and currentUser(), but neither seemed to work
You can see all your subscriptions at https://github.com/notifications/subscriptions. You can filter by reason and repository and sort by Most recently subscribed or Least recently subscribed.
Available subscription-reason filters
Any reason - Show all subscriptions
Assign - You were assigned to the Issue/PR.
Author - You created the thread.
Comment - You commented on the thread.
Manual - You subscribed to the thread (via an Issue or Pull Request).
Mention - You were specifically #mentioned in the content.
Review Requested - You were requested for review.
State Change - You changed the thread state (for example, closing an Issue or merging a Pull Request).
Team Mention - You were on a team that was mentioned.
You would not get a web-based search filter for "watched": the Advanced search does not include anything related to "watched/watching".
Even the GitHub API does not include anything regarding watching at the issue level.
There are only API calls for listing watchers at the repository level.

Is there a way to notify GitHub users of an update in one of my repos?

I have a Github repo which hasn't been updated for a long while (up until today).
I would like to notify users who cloned it in the past that the repo has been updated and that they better pull the changes.
Is there a way to do that?
You can use GitHub webhooks for this. You'll have to read the docs and add your own consumption logic for it.
If you rather not build your own consumption pipeline, consider using LightFlare (I'm the creator) that has out of the box support of consuming Webhooks events from many services (github included) and notifies you at your choice(s) of destinations (slack / email etc ...).

Slack GitHub integration, send messages by labels

When using slack with GitHub, is there any option to send messages by checking labels. For example if in commit exists label "design", message will go to 'design' channel. Is there any ready implementation or we need to do something custom?
No, not yet (May 2018, a year after the OP's question)
This is still pending in integrations/slack issue 384
I'm a member of a Slack channel dedicated to a specific feature of a repo that covers a wide variety of features. Right now we have an internal Hubot to filter down to a specific label and then post messages to the channel.
It'd be cool if this official integration could replace our internal by allow subscribing to only issues/PRs that have a specific label instead of the entire repo.
So it is technically possible, but for now through the use of an external third-party bot.
There is PR for this feature, but has not yet been approved/merged (15 months after it was submitted)
https://github.com/integrations/slack/pull/797
Our team ended up creating a custom integration

Automatic Github polling in JIRA

I have DVCS account in place. How do I make it update periodically without clicking being?
All the time commits from Github are appearing by JIRA issues after i manually click Synchronize in DVCS accounts administration.
How can I make it happen automatically?
Answer from support was to make a Webhook from the Github side. Automatic polling from JIRA side is done once per hour and this interval can't be changed since JIRA 6.3. Anyway there is JIRA DVCS Connector issue to vote it back into the JIRA -- https://jira.atlassian.com/browse/DCON-379.
Also I was provided with KB article which describes why and how to do it -- https://confluence.atlassian.com/display/JIRAKB/Slow+Appearing+Commits+from+BitBucket+or+GitHub+in+JIRA