Search code examples
.netgithubcoding-style

Is there a way to automatically run some checks when GitHub pull requests are created?


I am looking for automatically doing checks like:

  • Copyright header comments
  • Coding guidelines
  • Checking references for old libraries (I'll use this on .NET..)
  • something else..?

Solution

  • You could declare on your GitHub repo a webhook which would respond to a pull_request event.

    You need a server listening for the json payload sent by that webhook, but from there the listener can pull the PR branch, and perform any test you need.

    Another approach is enabling status check, with status checks being based on external processes, such as continuous integration builds, which run for each push you make to a repository. You can see the pending, passing, or failing state of status checks next to individual commits in your pull request.

    If status checks are required for a repository, the required status checks must pass before you can merge your branch into the protected branch.