Publishes a pull request on Bitbucket Server with specified title, description, and branch details.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| title | string | The title for the pull request | |
| token | string | The token to use for authorization to BitBucket Server | |
| repoUrl | string | Repository Location | |
| reviewers | array | The usernames of reviewers that will be added to the pull request | |
| description | string | The description of the pull request | |
| sourceBranch | string | Branch of repository to copy changes from | |
| targetBranch | string | - | |
| gitAuthorName | string | - | |
| gitAuthorEmail | string | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| pullRequestUrl | string | A URL to the pull request with the provider |
Usage Examples
Create a PR from a feature branch with reviewers
Creates a pull request from a feature branch to main and adds reviewers. Logs the PR URL using debug:log.
steps:
- id: create-pr
action: publish:bitbucketServer:pull-request
input:
repoUrl: bitbucketServer?host=${{ parameters.host }}&project=${{ parameters.projectKey }}&repo=${{ parameters.repoSlug }}
title: Add ${{ parameters.componentId }} scaffold
description: Scaffolded initial code and CI configuration.
targetBranch: main
sourceBranch: feature/${{ parameters.componentId }}-scaffold
reviewers: ${{ parameters.reviewers }}
- id: log-pr-url
action: debug:log
input:
message: Created PR at ${{ steps.create-pr.output.pullRequestUrl }}Hotfix PR to a release branch with service token and author
Opens a hotfix pull request to a release branch using an explicit token and author fields. Use this when the scaffolder needs to authenticate to Bitbucket Server with a service account.
steps:
- id: create-hotfix-pr
action: publish:bitbucketServer:pull-request
input:
repoUrl: bitbucketServer?host=bitbucket.acme.corp&project=ORDERS&repo=order-service
title: Hotfix prevent NPE in payment capture
description: Backports null check for payment capture to release branch.
targetBranch: release/2.1
sourceBranch: hotfix/payment-capture-npe
reviewers:
- qauser
- release-manager
token: ${{ secrets.bitbucket_token }}
gitAuthorName: Backstage Bot
gitAuthorEmail: backstage-[email protected]Minimal PR using repository default target branch
Creates a pull request with only the required fields. Bitbucket Server uses the repository default branch as the target when targetBranch is omitted.
steps:
- id: create-pr-minimal
action: publish:bitbucketServer:pull-request
input:
repoUrl: bitbucketServer?host=${{ parameters.host }}&project=PLAT&repo=search-service
title: Initial scaffold for search-service
sourceBranch: feature/search-service-bootstrapPR with multi-line description and JIRA references
Opens a pull request with a structured, multi-line description including JIRA references and checklist items.
steps:
- id: create-detailed-pr
action: publish:bitbucketServer:pull-request
input:
repoUrl: bitbucketServer?host=bitbucket.acme.corp&project=PLAT&repo=payments-service
title: "[PLAT-4821] Add metrics and dashboards"
description: |
Implements service metrics and Grafana dashboards.
- JIRA: https://jira.acme.corp/browse/PLAT-4821
- Adds Prometheus counters and histograms
- Updates alerts and SLOs
targetBranch: develop
sourceBranch: feature/plat-4821-metrics
reviewers:
- jdoe
- asmith
- opsuserEnvironment-specific PR with parameterized branch and reviewers
Creates a pull request to promote environment configuration changes. The branch name and reviewers are provided by template parameters, and the PR URL is logged with debug:log.
steps:
- id: create-env-pr
action: publish:bitbucketServer:pull-request
input:
repoUrl: bitbucketServer?host=${{ parameters.host }}&project=PLAT&repo=platform-configs
title: Promote ${{ parameters.environment }} configuration updates
description: Automated config update for ${{ parameters.environment }} environment.
targetBranch: ${{ parameters.targetBranch }}
sourceBranch: env/${{ parameters.environment }}/config-update
reviewers: ${{ parameters.approvers }}
- id: log-pr
action: debug:log
input:
message: Environment PR: ${{ steps.create-env-pr.output.pullRequestUrl }}