Skip to content

Orb containing `git` utilities to manage GitHub Pull Requests in CircleCI

License

Notifications You must be signed in to change notification settings

NarrativeScience-old/circleci-orb-ghpr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Orb: GitHub PR

CircleCI Orb Version License

Set of git utilities to manage GitHub Pull Requests in CI. This orb was created to address the need to simulate the result of merging the head branch into a PR's target base branch.

Additional features:

  • Posting PR comments on success/failure/always
  • Sending Slack notifications to PR authors

The commands in the orb will expose the following environment variables:

  • GITHUB_PR_BASE_BRANCH - The base branch for the PR.
  • GITHUB_PR_NUMBER - The number of the PR.
  • GITHUB_PR_TITLE - The title of the PR.
  • GITHUB_PR_COMMIT_MESSAGE - The current commit's message.
  • GITHUB_PR_AUTHOR_USERNAME - The PR author's username.
  • GITHUB_PR_AUTHOR_NAME - The PR author's name.
  • GITHUB_PR_AUTHOR_EMAIL - The PR author's email address.

All these commands will work out-of-the-box in jobs using the machine executor.

Getting Started

To use this orb, there are a few environment variables to set. These can be set in a Context or your Project's Environment Variables.

Setting up a GitHub service user

It's recommended to create a service GitHub user with at least Read access to your repository and set the following environment variables:

  • GITHUB_USERNAME - Username of the service user that has read/write permissions to the repo.
  • GITHUB_EMAIL - Email of the service user.
  • GITHUB_TOKEN - API token for the GitHub user

Enabling Slack Notifications

To use the Slack related orb commands, create or use an existing workspace bot and set the following environment variables:

  • SLACK_OAUTH_TOKEN - OAuth token for the Slack bot that will be used to send Slack messages.

The bot user will need at least the following bot token scopes:

Messages show as being sent by the user associated with the SLACK_OAUTH_TOKEN.

Example notification

Screen Shot 2020-06-03 at 21 55 38