Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I automatically decline an old pull request?

Jonathan Lamb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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 Champion
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