1

I am using bitbucket pipelines for PR raised pipeline, is there any way to write in bitbucket-pipelines.yml or in bitbucket settings to Cancel/Decline PR if pipeline gets failed at any step?

There are variables like "BITBUCKET_PR_ID", "BITBUCKET_EXIT_CODE", which contains PR ID and exit status code, can we automate process by that?

MAIN OBJECTIVE: To cancel the pull-request if any step get failed in Bitbucket-Pipelines.

1 Answers1

0

I'm not sure if there is an in-built function or similar that you can call from within BB pipelines that will decline the PR automatically. However, note that even if there isn't a way to decline the PR in-built to BB pipelines, there still is an API endpoint that allows you to do it.

You can check what the BITBUCKET_EXIT_CODE is and depending on that, you can call the endpoint. You only need the PR_ID to pass as a parameter, which you already have.

M B
  • 2,700
  • 2
  • 15
  • 20