Page MenuHomePhabricator

Create a Github notification bot for phabricator
Open, MediumPublic

Description

It would be useful to have a connection between Github and Phabricator, for projects that have repos on Github. This could be done by a Phab-bot, using webhooks to get information from Github and conduit to do things with Phab-tasks.

Things that should be handled like @gerritbot:

  • When a pull-request is created on Github, webhooks will trigger the bot.
  • If the bot finds Bug: TXXX in PR or commit message, it should post a message on the phab ticket with Patch-For-Review tag, and potentially assign this ticket to commiter (how ?)
  • When a pull-request is merged on Github, webhooks will trigger the bot.
  • The bot will post a message on the phab ticket.

What the bot should do in other words:

  • Assigning a reviewer on Github adds a comment with link to the PR and to the related task. Also adds Patch-For-Review.
  • Merging a PR adds comment to the related task.

Requirements:

  • PR:s need to provide task id(s).

Tool name: github-notif-bot - contact @Framawiki for access

Existing work

It appears some teams are already working toward this functionality with raw github actions.
Examples:

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

It will be very useful for projects like Huggle.
I would like to work on this, by create a Python bot.

Great if you would take this on! It is something we would need for a couple of our projects as well we just never get around to building it =)

Framawiki renamed this task from Automate Github to Phabricator actions to Create a Github notification bot for phabricator.May 11 2017, 4:22 PM

Some research:

bd808 awarded a token.

https://phab-01.wmflabs.org/p/Github-notif-bot/

>>> phab.maniphest.edit(objectIdentifier='T183', transactions=[{'type':'comment', 'value':'valeur'}, {'type':'projects.add', 'value':['Patch-For-Review']}])

:-)

I'll now create tasks in Github-notif-bot project and continue to make general reports here.

WMDE, especially the WMDE-FUN-Team might be interested in this as well.

Aklapper subscribed.

This task has been assigned to the same task owner for more than two years. Resetting task assignee due to inactivity, to decrease task cookie-licking and to get a slightly more realistic overview of plans. Please feel free to assign this task to yourself again if you still realistically work or plan to work on this task - it would be welcome!

For tips how to manage individual work in Phabricator (noisy notifications, lists of task, etc.), see https://phabricator.wikimedia.org/T228575#6237124 for available options.
(For the records, two emails were sent to assignee addresses before resetting assignees. See T228575 for more info and for potential feedback. Thanks!)

Unfortunately I'm no longer planning to work on this topic. In particular, now that we have a Wikimedia Gitlab instance, I don't see reasons to still use Github.

In the meantime, a similar account has been created by @rook under the account @github-toolforge-bot.

Novem_Linguae added a subscriber: Dbrant.

I note that @GitHubPRBot and @github-toolforge-bot both exist, but clicking on their profiles, I don't see links to their repos or instructions for how to sign up to use them for one's own GitHub repos. Is one of these bots usable by the public (which would resolve this ticket, just need to document it better)?

cc @Dbrant, @rook

To use github-toolforge-bot, a workflow needs to be created in the github repo (see https://github.com/toolforge/quarry/blob/main/.github/workflows/notification.yaml). An API token for the bot's phab account needs to be stored on GitHub Secrets (as TOOLFORGE_PHAB_BOT_KEY in this example). I assume a new token should be used for each github repo, and phabricator admins can generate these tokens on request.

Nice. If this solution is public / open to all developers, I'd recommend documenting the process somewhere (on a wiki page? in a repo as a README?), linking to it in the bot's phab profile, then closing this ticket as resolved.