You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Whenever a build fails, the associated pull request should be automatically rejected. Is there any setting for that?
Hi @Eshwar Iyer,
We don't have such a setting available, however, there may be a solution by using our API to decline a PR:
Are you using Bitbucket Pipelines for your builds? And if so, do you have builds running on pull-requests?
If that's the case, you can include the following after-script in your step:
script:
- <build_commands here>
after-script:
- if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then curl -u ${Bitbucket_Username}:${Bitbucket_AppPassword} -X POST https://api.bitbucket.org/2.0/repositories/$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG/pullrequests/$BITBUCKET_PR_ID/decline; fi
where Bitbucket_Username and Bitbucket_AppPassword are Repository variables holding the Bitbucket username and app password respectively of a user that has enough permissions to decline a PR. Please note that BITBUCKET_PR_ID is available only for builds that run on pull-requests.
If you have multiple steps, you can add this after-script in all steps.
Please let me know if you're using a different CI/CD system, or if you're using Pipelines but with builds not running on pull-requests (and what you mean by associated PR in this case).
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.