-
Configure github-plugin according to it’s documentation.
-
Set
GitHub project propertywith link to your GitHub repository in Job settings. -
Configure git-plugin: add any repo name i.e. 'origin-pull' and set refspec to
+refs/pull/${GITHUB_PR_NUMBER}/merge:refs/remotes/origin-pull/pull/${GITHUB_PR_NUMBER}/mergeif you want run build for merged state or '/head' for building exact PR commits, or$GITHUB_PR_COND_REFif you want 'head' state when PR is not mergeable (according to GH state). Set branch specifier toorigin-pull/pull/${GITHUB_PR_NUMBER}/merge. This exact link allows to speedup fetch sources. -
Enable "Build GitHub Pull Requests" trigger and configure it.
-
If you want do gatekeepering, then add second repository with i.e. origin. Add
Mergeextension in from Git SCM and configure post build action for push action.
-
If you want to set commit status right before job was put to Jenkins queue, enable
Set status before buildcheckbox in trigger configuration (it will have no links because there is no real builds in jenkins, only queue item that is not a build) -
In
BuildsectionAdd Build stepcalledGitHub PR: set pull request status to "pending"and enter some message likeBuild #${BUILD_NUMBER} started -
In
Post-build ActionsaddGitHub PR: set PR statusand configure message toBuild #${BUILD_NUMBER} ended
-
GITHUB_PR_TRIGGER_SENDER_AUTHOR-Kanstantsin Shautsou -
GITHUB_PR_TRIGGER_SENDER_EMAIL-KostyaSha@users.noreply.github.com -
GITHUB_PR_COMMIT_AUTHOR_NAME -
GITHUB_PR_COMMIT_AUTHOR_EMAIL -
GITHUB_PR_TARGET_BRANCH-master -
GITHUB_PR_SOURCE_BRANCH-KostyaSha-patch-9 -
GITHUB_PR_AUTHOR_EMAIL-KostyaSha@users.noreply.github.com -
GITHUB_PR_SHORT_DESC- -
GITHUB_PR_TITLE-Update README.md -
GITHUB_PR_URL-KostyaSha/test-repo#21 -
GITHUB_PR_SOURCE_REPO_OWNER-KostyaSha -
GITHUB_PR_HEAD_SHA-8c8e496391619410bded8bb113d4887443ea3b53 -
GITHUB_PR_COND_REF-head -
GITHUB_PR_CAUSE_SKIP-false -
GITHUB_PR_NUMBER-21 -
GITHUB_PR_STATE-OPEN -
GITHUB_PR_COMMENT_BODY-test foo, bar tags please.When PR was triggered by comment. -
GITHUB_PR_COMMENT_BODY_MATCH-foo, barWhen PR wass triggered by comment and had group match.
-
Configure github-plugin according to it’s documentation.
-
Set
GitHub project propertywith link to your GH repository in Job settings. -
Configure Git SCM with variables refspec:
refs/heads/${GITHUB_BRANCH_NAME}:refs/remotes/origin/${GITHUB_BRANCH_NAME}url${GITHUB_REPO_GIT_URL}, branchspec${GITHUB_BRANCH_NAME}.
-
GITHUB_BRANCH_NAME-KostyaSha-patch-1 -
GITHUB_BRANCH_SHORT_DESC -
GITHUB_BRANCH_TITLE -
GITHUB_BRANCH_URL -
GITHUB_BRANCH_HEAD_SHA-850f36c6e494c5d85c748e61337647f003106bfb -
GITHUB_BRANCH_FULL_REF-refs/heads/KostyaSha-patch-1 -
GITHUB_BRANCH_CAUSE_SKIP-trueorfalse