Home > Net >  can we raise a PR in github through jenkins
can we raise a PR in github through jenkins

Time:06-11

there is a requirement to automate the PR via jenkins,when changes done in github repo.the jenkins should automatically raise pull request. is it possible automate .plz help me with this issue.

Thanks in advance.

CodePudding user response:

You can use Gitcli for this. This can be executed through Jenkins using a shell executor.

CodePudding user response:

if you could explain the requirement in more detail, it would be more helpful.

One way I could think of raising a PR on GitHub using Jenkins is by using GitHub's API.

  • GitHub has an API to work with pull requests. I believe you would specifically need the "Create a pull request" API.
  • Jenkins has a plugin - "HTTP Request" to make HTTP requests.
  • In your Jenkins pipeline, create a job that makes a POST request to the /repos/{owner}/{repo}/pulls endpoint. You can declare the status as success/failure based on the response status code.
  • Related