Skip to content

Instantly share code, notes, and snippets.

@wmathes
Created July 3, 2017 09:28
Show Gist options
  • Save wmathes/bc51e7186a417ac8fd29e40657f39415 to your computer and use it in GitHub Desktop.
Save wmathes/bc51e7186a417ac8fd29e40657f39415 to your computer and use it in GitHub Desktop.
Things a bot should do...

These are favoured functionalities for a bot handling github Issues and PR. It has most of the functionalities of WaffleBot as well as others.

states

The bot is mostly focusing on adding/removing labels to issues and PRs to indicate their current state in addition to their open/closed states.

Note that all these labels are considered temporary and are removed from an issue/pr when it closes.

in-progress indicates that work has started on an issue. Reacts to creation of branches with a issue-id prefix (like 123-my-branch) and to commit messages containing an autoclose-tag for the issue.

blocked indicates that an issue requires the completion of another issue/pr first. The label is added to a pr/issue if its description contains need/needs/require/requires #123. The label is also added to an issue, if another issue/pr description contains block/blocks #123.

It will be removed once all issue/pr referenced this way have been closed/merged.

is-blocking is a counter for the blocked-label, which is added to an issue/pr if it is blocking the progress for another issue/pr.

in-review on an issue indicates that there is an open, non-WIP PR for an issue. It is added to all issues referenced by branch name prefices or within the PR description. It will be added/removed if the branch-name removes/adds the WIP-prefix

logic

add-in-progress-label

triggers:

  • branch created with numeric prefix #?[0-9]*(-|_) aka #213-, 42_ and combinations.
  • pr created/renamed to WIP(.*) with autoclose text for an issue.

action:

  • add in-progress-label to referenced issue.
  • assign branch author to the issue if unassigned.

remove-in-progress-label

triggers:

  • issue closed

action:

  • remove in-progress-label from issue.

add-in-review-label

Shows up on issues, when there's a referencing, open, non-WIP PR. Indicates that an issue is in a review-stage and might be closed soon. Shows up on PRs as well, to simplify filtering (because labels can be click-filtered)

triggers:

  • pr created/renamed

checks:

  • pr name is not prefixed by WIP.

action:

  • add in-review-label to PR.
  • add in-review-label to issue referenced by branch-name-prefix.
  • add in-review-label to isses referenced by autoclose tags.

remove-in-review-label

triggers:

  • pr merged/issue closed.

action:

  • remove in-review-label.

blocked-labels

add-blocked-label

triggers:

  • text (need|needs|require|requires) #[0-9]* in a issue/pr description or comment.

checks:

  • require the referenced issue/pr to open/unmerged.

actions:

  • add a blocked-label to the issue/pr.

remove-blocked-label

triggers:

  • issue closes/pr merged

checks:

  • issue/pr is reference by a issue/pr with a blocked-label.
  • the referenced issue is blocked by the active issue/pr.
  • the active issue/pr is the last remaining blocking issue/pr for the referenced pr/issue

action

  • remove blocked-label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment