Installing the script
Integrating with exisiting bot
Install the script via
npm install hubot-pr-fu --save
Add the script to your
[ "hubot-pr-fu" ]
And start your bot
Running hubot-pr-fu Locally
You can test your hubot by running the following, however some plugins will not behave as expected unless the environment variables they rely upon have been set.
You can start hubot-pr-fu locally by running:
% bin/hubot -a slack
- There might be some inconsistency with determining the conflict of
PRs. GitHub's API returns a
mergeablekey in the response that has three possible states:
nilstate means that the mergeability of that PR has not yet been determined, and a background job has been scheduled. For reasons of making the logic simpler, we don't display information about these
nilstate PRs. So there might be a rare case where the total number of PRs in
pr allcommand doesn't match with the sum of mergeable PRs and non-mergeable PRs in the same command's response.
Note: This bot is still under active development, and so has really little error checking (existence of organization or repo, valid permissions etc.). User discretion is advised
User specific commands
pr orgname/repo all
This command returns the PR stats for the repo specified under the specified organization. This information would include:
- Total open PRs
- Total PRs which are mergeable and those which are not
- List of users who have open PRs and links to each of those
pr orgname/repo conflicts
This command returns all the PRs which have merge conflicts. This has
more detailed information for those compared to
pr all command.
The title, PR number, link to that PR, assignee and the username who
opened this PR is included in the information.
pr orgname/repo <username>
This command returns all the PRs opened by this user. This includes all
open PRs which are mergeable and non-mergeable. The
assumed to be a valid Github username. For now, there is no
authorization or authentication built-in. Another assumption is that a
username in lowercase is same as capitalized or camelcased. That is, for
bootstrap, the users
bootStrap are the same.
One caveat is that the robot will treat every string after
conflicts as a username. So, don't abuse this.
Adding a way to make this better is in the works.
Some env vars are assumed to exist:
- HUBOT_SLACK_TOKEN (Get this from Slack account page) Read this for steps to obtain a slack token and set the bot name steps](#getting-a-slack-token) to know the name of the bot.
- GH_AUTH_TOKEN (Get this from Github)
Getting a Slack Token
- Signin into Slack via https://slack.com/signin
- Head to https://.slack.com/services/new/bot
- Register a new bot with whatever name you want
- Save the service, and you'll be shown the API key. Grab this key and
k set it to
An example script is included at
scripts/example.coffee, so check it out to
get started, along with the Scripting Guide.