0

I have a Jenkins job which gets triggered every time someone tries to merge a pull request into my github repo.

This job (among other things) is supposed to run pylint only on the commits that are to be merged.

If the pull request contains only a single commit, this is easy to implement.

However, the PR may contain multiple commits.

The Jenkins job runs a bash script to accomplish this.

How can I list all the changed files in all the new commits that are to be merged in the github pull request so that I can run pylint on all of them?

rohitsan
  • 867
  • 6
  • 22
  • Do you think this might answer your question? https://stackoverflow.com/questions/25071579/list-all-files-changed-in-a-pull-request-in-git-github – Nivi Dec 05 '20 at 14:09
  • No, unfortunately that didn't work. – rohitsan Dec 05 '20 at 14:19
  • Somehow github is able to determine this because you can see it by choosing the appropriate tab in the UI. Does anyone know how they do it? – rohitsan Dec 05 '20 at 14:20

1 Answers1

0

You could just use GitHub API for pull requests.

GET /repos/:owner/:repo/pulls/:pull_number/files
spotHound
  • 102
  • 1
  • 10
  • This is supposed to be implemented in a script residing in the git repo. I am not sure how to discern the pull request number to construct that API GET request. Also, I don't want the solution to be github specific. – rohitsan Dec 06 '20 at 15:05