#How to push files to existing Bitbucket Cloud repo and create PR using Backstage scaffolder?

7 messages · Page 1 of 1 (latest)

lethal kelp
#

Hi everyone,
I'm trying to create a Backstage template that pushes a generated file to an existing Bitbucket Cloud repository and automatically creates a pull request. However, I'm running into issues with the built-in actions.
What I've tried:

publish:bitbucketCloud - This tries to create a new repository instead of pushing to an existing one, and fails with:

Error: Unable to create repository, 403 Forbidden
Required scope: admin:repository:bitbucket

publish:bitbucketCloud:pull-request - This expects a branch to already exist and fails with:

Error: There are no changes to be pulled
My use case:

Generate a Terraform file from a template
Push it to an existing repo (e.g., bitbucket.org/workspace/my-infra-repo)
Create a PR automatically for review

Question:
Has anyone successfully implemented a workflow to push files to an existing Bitbucket Cloud repository using Backstage scaffolder actions?

Is there a combination of actions that works?
Do I need to create a custom scaffolder action using the Bitbucket API?
Are there any community plugins that solve this?

My setup:

Using Bitbucket Cloud (not Server)
API tokens configured with repository:write and pullrequest:write scopes

Any guidance would be greatly appreciated!

covert lion
#

Hey, I just implemented that with GitHub

#

Make sure your github app has enough permissions

#

You might not have permission to create PR's

lethal kelp
# covert lion Hey, I just implemented that with GitHub

Thanks! Just to clarify - when you say you implemented this with GitHub, did you use:

  • action: publish:github

    This creates repos

OR

  • action: publish:github:pull-request

    This works with existing repos

I'm looking for the Bitbucket Cloud equivalent of the second approach. The publish:bitbucketCloud action only seems to support creating new repos, not working with existing ones.

covert lion
#

publish:github:pull-request

covert lion