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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,024
Community Members
 
Community Events
184
Community Groups

Can a pull request be automatically declined if the build fails ?

Whenever a build fails, the associated pull request should be automatically rejected. Is there any setting for that?

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 03, 2022

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events