Mansi
Mansi

Reputation: 121

GitHub Pull Request Builder not triggering Jenkins job

I have followed https://plugins.jenkins.io/ghprb/ and created Jenkins job. I created Gitwebhook http://:/ghprbhook/. Selected the “Let me select individual events” option and selected just the “Pull requests” option. I can see green tick in for that hook. Selected Github project option and entered the Github repo URL for which I want the PR builds without .git extension.Selected Git SCM.Added GitHub "Repository URL".Under Advanced, set "refspec" to +refs/pull/:refs/remotes/origin/pr/. In "Branch Specifier", entered ${sha1}. Under "Build Triggers", checked "Github pull requests builder". Added myself as admin.Checked "Use github hooks for build triggering". But If I create a PR it does not trigger this job. Please help on this.

Upvotes: 0

Views: 4631

Answers (1)

harry
harry

Reputation: 179

Follow the below steps and try this, it would work for you.

  • Repository URL = Paste your repository URL
  • Credential = select your credential

Click Advanced Section

  • Name = put origin
  • Refspec = put +refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*
    Branches to build
  • put ${ghprbActualCommit}

enter image description here

Under Build Triggers

  • check "Github pull requests builder"
    • Select your GitHub API credentials
    • check Use github hooks for build triggering
    • check Build every pull request automatically without asking (Dangerous!)

Thanks

Upvotes: 2

Related Questions