Missed Team ’24? Catch up on announcements here.

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

Bitbucket Pipeline - Error creating a Pull Request - "Branch not found"

Andy Rouse February 8, 2023

I'm trying to create a scheduled pipeline which will retrieve from a Salesforce instance and create a Pull request with any changes that have been retrieved. Broadly speaking it:

  1. Checkouts "develop"
  2. Creates a new branch locally
  3. Retrieves from Salesforce
  4. Commits the changes
  5. Pushes the new branch to Bitbucket
  6. Calls the API to create a Pull Request for somebody to review and merge to "develop"

The issue is with step 6. The call to the API results in an error:

"source: branch not found: {{branch name is in here}}"

The bitbucket bash script has the following commands directly following each other:

  • git push
  • node {{reference to JS file which makes the API call}}

The branch name matches with the one just pushed. Is there an issue with timing (e.g. do we need to pause before making the API call), or is something else at play here?

EDITED TO ADD MORE DETAILS

  • I've update my node script to include a delay, but that hasn't appeared to have worked
  • I've used Postman API with the same bearer token and, as far as I can tell, the same API call and that is able to create the Pull Request as expected.

 

1 answer

1 accepted

0 votes
Answer accepted
Andy Rouse February 8, 2023

Apologies - This was related to a typo in the arguments passed between the bash script and the node javascript.

It is completely possible to git push in the bash script and immediately call the pull requests API in the node script and create a Pull Request

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events