Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I automatically decline an old pull request?

Jonathan Lamb November 9, 2017

We just had a situation where a PR was built and approved 2mo ago but never merged.   It was just merged and broke the build.  I'd like to just fence out aged PRs, rather than requiring a pre-merge commit hook that fails the build.  How can I do this?

1 answer

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 10, 2017

ScriptRunner is an app for Bitbucket that allows custom logic.

I am quite sure that you could create a 3-line Groovy script that would do something like this:

// check if the PR is older than 30 days
if((System.currentTimeMillis() - pullRequest.createdDate.time) > 30*24*60*60*1000) {
// ... reject the PR
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events