<p>Most repository managers have some way of implementing this.</p>

<p>GitHub (and GitHub Enterprise) has the idea of statuses on a commit; you'd set up <a href="https://developer.github.com/webhooks/" rel="nofollow noreferrer">a webhook</a> that pings your tool's webserver when a commit is pushed, and then it would use <a href="https://developer.github.com/v3/repos/statuses/" rel="nofollow noreferrer">the status API</a> to set whether or not it passes the version check.</p>

<p>Bitbucket, when self-hosted, supports plugins to integrate nicely with it, including <a href="https://marketplace.atlassian.com/plugins/com.onresolve.stash.groovy.groovyrunner/server/overview" rel="nofollow noreferrer">ScriptRunner</a>, which can be used to do all sorts of things similar to what you want.</p>

<p>I'm not familiar with GitLab, but it probably has some similar method.</p>

<p>You will need to do some programming to implement the checking logic, but these pieces should allow you to kick that off when appropriate and use the results to block the merge.</p>

CC BY-SA 3.0
2018-01-31T20:42:42.593Z
2018-01-31T21:16:49.323Z
2018-01-31T21:16:49.323Z
Xiong Chiamiov
<p>I am looking to migrate a handful of Subversion repositories to Git. Each of these repositories has a development and production branch. When ready to release, a developer will submit a pull request to production. There is a version file that contains the version that has to be incremented in some way. Is there a Git repository manager (Gitlab, Bitbucket, etc.) that allows you to automatically deny pull requests based on a condition? My condition in this example would be the version in a version file is not incremented. I am also willing to consider other methods, such as tagging the repositories instead of a version file, if auto-denying in that way is possible. </p>

<git><repository>
Git Repository Manager conditionally deny pull request
Preston Martin
# Git Repository Manager conditionally deny pull request

(Asked by: username_0 on 2018-01-31)

I am looking to migrate a handful of Subversion repositories to Git. Each of these repositories has a development and production branch. When ready to release, a developer will submit a pull request to production. There is a version file that contains the version that has to be incremented in some way. Is there a Git repository manager (Gitlab, Bitbucket, etc.) that allows you to automatically deny pull requests based on a condition? My condition in this example would be the version in a version file is not incremented. I am also willing to consider other methods, such as tagging the repositories instead of a version file, if auto-denying in that way is possible.

**Tags:** git, repository


---

## 1 answers

### Answer by username_1 on 2018-01-31. Score: 1 | Accepted answer

Most repository managers have some way of implementing this.

GitHub (and GitHub Enterprise) has the idea of statuses on a commit; you'd set up [a webhook](https://developer.github.com/webhooks/) that pings your tool's webserver when a commit is pushed, and then it would use [the status API](https://developer.github.com/v3/repos/statuses/) to set whether or not it passes the version check.

Bitbucket, when self-hosted, supports plugins to integrate nicely with it, including [ScriptRunner](https://marketplace.atlassian.com/plugins/com.onresolve.stash.groovy.groovyrunner/server/overview), which can be used to do all sorts of things similar to what you want.

I'm not familiar with GitLab, but it probably has some similar method.

You will need to do some programming to implement the checking logic, but these pieces should allow you to kick that off when appropriate and use the results to block the merge.


---

