Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Provides a Github pull request resource for concourse CI.

License

NotificationsYou must be signed in to change notification settings

jtarchie/github-pullrequest-resource

Repository files navigation

We would like for you to start using the newgithub-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 thisissue.

Github Pull Request Resource

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

NOTE: Pull requests are implemented differently between the git repo providers. Thisresource only supportGITHUB.

Deploying to Concourse

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

For example:

resource_types:-name:pull-requesttype:docker-imagesource:repository:jtarchie/pr

Source Configuration

  • repo:Required. The repo name on github.Example:jtarchie/pullrequest-resource

  • access_token:Required. An access token withrepo:status access isrequired forpublic repos. An access token withrepo access is required forprivate repos.

  • uri:Optional. The URI to the github repo. By default, it assumeshttps://github.com/`repo`.

  • base:Optional. When set, will only pull PRs made against a specific branch. Thedefault behaviour is any branch.

  • base_url:Optional The base URL for the Concourse deployment, used forlinking to builds. On newer versions of Concourse ( >= v0.71.0) , the resource willautomatically sets the URL.

    This supports thebuild environmentvariables provided by concourse. For example,context: $BUILD_JOB_NAME will set the context to the job name.

  • private_key:Optional. Private key to use when pulling/pushing.Example:

    private_key: |  -----BEGIN RSA PRIVATE KEY-----  MIIEowIBAAKCAQEAtCS10/f7W7lkQaSgD/mVeaSOvSF9ql4hf/zfMwfVGgHWjj+W  <Lots more text>  DWiJL+OFeg9kawcUL6hQ8JeXPhlImG6RTUffma9+iGQyyBMCGd1l  -----END RSA PRIVATE KEY-----
  • api_endpoint:Optional. If the repository is located on a GitHub Enterpriseinstance you need to specify the base api endpoint (e.g. "https://<hostname>/api/v3/").

  • disable_forks:Optional, default false. If set totrue, it will filterout pull requests that were created via users that forked from your repo.

  • only_mergeable:Optional, default false. If set totrue, it will filterout pull requests that are not mergeable. A pull request is mergeable if it has no merge conflicts.

  • require_review_approval:Optional, default false. If set totrue, it willfilter out pull requests that do not have an Approved review.

  • authorship_restriction:Optional, default false. If set totrue, will onlyreturn PRs created by someone who is a collaborator, repo owner, or organization member.

  • label:Optional. If set to a string it will only return pull requests that have beenmarked with that specific label. It is case insensitive.

  • username:Optional. Username for HTTP(S) auth when pulling/pushing.This is needed when only HTTP/HTTPS protocol for git is available (which does not support private key auth)and auth is required.

  • password:Optional. Password for HTTP(S) auth when pulling/pushing.

  • paths:Optional. If specified (as a list of glob patterns), only changesto the specified files will yield new versions fromcheck.

  • ignore_paths:Optional. The inverse ofpaths; changes to the specifiedfiles are ignored.

  • ci_skip:Optional. Filters out PRs that have[ci skip] message. Defaultisfalse.

  • skip_ssl_verification:Optional. Skips git ssl verification by exportingGIT_SSL_NO_VERIFY=true and applying it to the Github API client.

  • git_config:Optional. If specified as (list of pairsname andvalue)it will configure git global options, setting each name with each value.

    This can be useful to set options likecredential.helper or similar.

    See thegit-config(1) manual pagefor more information and documentation of existing git options.

Behavior

check: Check for new pull requests

Concourse resources always iterate over the latest version. This maps well tosemver and git, but not with pull requests. This filters all open PRssorted 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. Itis important to specifyversion: every, otherwise you will only ever get thelatest PR.

There isgit 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 requestgit config --get pullrequest.branch# returns the branch name used for the pull requestgit config --get pullrequest.id# returns the ID number of the PRgit config --get pullrequest.body# returns the PR bodygit config --get pullrequest.basebranch# returns the base branch used for the pull requestgit config --get pullrequest.basesha# returns the commit of the base branch used for the pull requestgit config --get pullrequest.userlogin# returns the github user login for the pull request author

Additional files populated

  • .git/id: the pull request id

  • .git/url: the URL for the pull request

  • .git/branch: the branch associated with the pull request

  • .git/base_branch: the base branch of the pull request

  • .git/base_sha: the commit of the base branch of the pull request

  • .git/userlogin: the user login of the pull request author

  • .git/head_sha: the latest commit hash of the branch associated with the pull request

  • .git/body: the body of the pull request.

Parameters

  • git.depth:Optional. If a positive integer is given,shallow clone therepository using the--depth option.

  • git.submodules:Optional, defaultall. Ifnone, submodules will not befetched. If specified as a list of paths, only the given paths will befetched. Ifall, all submodules are fetched.

  • git.disable_lfs:Optional. Iftrue, will not fetch Git LFS files.

  • fetch_merge:Optional, defaultfalse. If set totrue, it will fetchwhat the result of PR would be otherwise it will fetch the origin branch.

out: Update the status of a pull request

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

Parameters

  • path:Required. The path of the repository to reference the pull request.

  • status:Required. The status of success, failure, error, or pending.

    • on_success andon_failure triggers may be useful for you when you wanted to reflect build result to the PR (see the example below).
  • context:Optional. The context on the specified pull request(defaults tostatus). Any context will be prepended withconcourse-ci, soa context ofunit-tests will appear asconcourse-ci/unit-tests on Github.

    This supports thebuild environmentvariables provided by concourse. For example,context: $BUILD_JOB_NAME will set the context to the job name.

  • comment:Optional. The file path of the comment message. Comment owner is same with the owner ofaccess_token.

  • merge.method:Optional. Use this to merge the PR into the target branch of the PR. There are three available merge methods --merge,squash, orrebase. Please thisdoc for more information.

  • merge.commit_msg:Optional. Used withmerge to set the commit message for the merge. Specify a file path to the merge commit message.

  • label:Optional. A label to add to the pull request.

Example pipeline

Please see this repo'spipeline for a perfect example.

There's also anexample by @starkandwayne.

Running the tests

Requiresruby to be installed.

gem install bundlerbundle installbundleexec rspec

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

docker build .

About

Provides a Github pull request resource for concourse CI.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors28


[8]ページ先頭

©2009-2025 Movatter.jp