Home

Awesome

DEPRECATED

We would like for you to start using the new github-pr-resource that is based on Github's GraphQL resources. Using GraphQL fixes a lot of issues this repo has.

For history or context regarding this change, please see this issue.

Github Pull Request Resource

Tracks Github pull requests made to a particular Github repo. In the spirit of Travis CI, a status of pending, success, or failure will be set on the pull request, which must be explicitly defined in your pipeline.

NOTE: Pull requests are implemented differently between the git repo providers. This resource only support GITHUB.

Deploying to Concourse

You can use the docker image by defining the resource type in your pipeline YAML.

For example:


resource_types:
- name: pull-request
  type: docker-image
  source:
    repository: jtarchie/pr

Source Configuration

Behavior

check: Check for new pull requests

Concourse resources always iterate over the latest version. This maps well to semver and git, but not with pull requests. This filters all open PRs sorted by most recently updated.

in: Clone the repository, at the given pull request ref

Clones the repository to the destination, and locks it down to a given ref. It is important to specify version: every, otherwise you will only ever get the latest PR.

There is git config information set on the repo about the PR, which can be consumed within your tasks.

For example:

git config --get pullrequest.url        # returns the URL to the pull request
git config --get pullrequest.branch     # returns the branch name used for the pull request
git config --get pullrequest.id         # returns the ID number of the PR
git config --get pullrequest.body       # returns the PR body
git config --get pullrequest.basebranch # returns the base branch used for the pull request
git config --get pullrequest.basesha    # returns the commit of the base branch used for the pull request
git config --get pullrequest.userlogin  # returns the github user login for the pull request author

Additional files populated

Parameters

out: Update the status of a pull request

Set the status message for concourse-ci context on specified pull request.

Parameters

Example pipeline

Please see this repo's pipeline for a perfect example.

There's also an example by @starkandwayne.

Running the tests

Requires ruby to be installed.

gem install bundler
bundle install
bundle exec rspec

Or with the Dockerfile, which runs the tests to see if it can successfully build:

docker build .