[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

alvarocavalcanti/pierre-decheck

Repository files navigation

Pierre DeCheck - A Dependent Pull-Request Checker

DISCLAIMER: THIS REPO IS NOW ARCHIVED

CircleCI

Key Features

It checks for dependent pull requests, both same-repo and external, which should be defined by keywords on either pull request's body or comments:

  • Same repo: Depends on #1
  • External:
    • Depends on alvarocavalcanti/pierre-decheck#1
    • Depends on https://github.com/alvarocavalcanti/pierre-decheck/pull/1

Pierre will perform checks only upon PR creation and Comment Activity (added/removed). In every case it will fetch all the PR's bodies (the PR body itself and from all its comments), extract the dependencies and perform the checks. Thus, it does not observe the dependencies themselves and re-run the checks if their status change.

For now, the best way of re-checking the dependencies statuses is to add a new comment. I suggest pierre re-check. 😃

Installation

  1. Checkout/download this repo
  2. Publish the app wherever suits you the best (it has both Heroku and AWS Lambda configuration in place) and take note of the app's URL
  3. Go to the repository you want to set it up, then go to Settings > Webhooks > Add Webhook
  4. Under "Payload URL" enter <YOUR_APP_URL>/webhook
  5. Under "Content type" select "application/json"
  6. Under "Which events would you like to trigger this webhook?" select "Let me select individual events." and then: "Commit comments", "Issue comments", "Issues", "Pull requests" and "Pull request review comments"
  7. Finally, make sure "Active" is selected and then create the webhook
  8. Create an access token for your repo and grant it with either repo:status for Public repos or repo (Full control of private repositories) for Private repos.
  9. Add the token as an environment variable for you app, labeled GITHUB_TOKEN

Usage

  1. Create a pull request on the repository that has pierre set up
  2. Add the keywords Depends on # (for same-repo) or "Depends on owner/repo#" (for external) followed by an issue/pull request number, Depends on #2 or Depends on owner/repo#2, to the pull request description, or later, as a comment. (Alternatively, Depends on <GITHUB_URL_OF_ISSUE_OR_PR> style can be used) Pull Request Checks Example
  3. Every time a comment is added or deleted, pierre will check the dependencies and update the "Checks" section: Pull Request Checks Example

Optional feature: Depending on a Released PR

Usually when one has external dependencies (other repos) these dependencies requires not only a PR to be merged, but also released. To that extent, Pierre offers an optional configuration: by setting the environment variable RELEASE_LABEL to any given value, Pierre will then consider any dependency as met only if its state is closed and if it also has the proper label. On the screenshot below it's possible to see how it looks like when the dependency is closed but does not have the release label:

Pull Request Checks Exemple

Contributing

Contributing document.

Code Style

Code style document.

Recommended IDEs

  1. PyCharm - Community edition is free and decent, Professional edition is awesome
  2. VisualStudio Code - Completely free, large amount of extensions and great community support

References

  1. Github Repo Statuses
  2. Github Webhooks
  3. Github Events
  4. Github Event Types & Payloads
  5. Building a CI Server (Github Guide)