Publishes a pull request to GitHub with specified changes, reviewers, and assignees.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| draft | boolean | Create a draft pull request | |
| title | string | The name for the pull request | |
| token | string | The token to use for authorization to GitHub | |
| update | boolean | Update pull request if already exists | |
| repoUrl | string | Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the repository name and `owner` is an organization or username | |
| assignees | array | The users that will be added as assignees to the pull request | |
| forceFork | boolean | Create pull request from a fork | |
| reviewers | array | The users that will be added as reviewers to the pull request | |
| branchName | string | The name for the branch | |
| sourcePath | string | Subdirectory of working directory to copy changes from | |
| targetPath | string | Subdirectory of repository to apply changes to | |
| description | string | The description of the pull request | |
| commitMessage | string | The commit message for the pull request commit | |
| filesToDelete | array | List of files that will be deleted | |
| gitAuthorName | string | Sets the default author name for the commit. The default value is the authenticated user or `Scaffolder` | |
| teamReviewers | array | The teams that will be added as reviewers to the pull request | |
| gitAuthorEmail | string | Sets the default author email for the commit. The default value is the authenticated user or `scaffolder@backstage.io` | |
| createWhenEmpty | boolean | Set whether to create pull request when there are no changes to commit. The default value is true. If set to false, remoteUrl is no longer a required output. | |
| targetBranchName | string | The target branch name of the pull request | |
| forceEmptyGitAuthor | boolean | Forces the author to be empty. This is useful when using a Github App, it permit the commit to be verified on Github |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| remoteUrl | string | Link to the pull request in Github | |
| targetBranchName | string | Target branch name of the merge request | |
| pullRequestNumber | number | The pull request number |
Usage Examples
Open a feature PR with reviewers and assignees
Creates a pull request with generated changes and requests reviews from specific users. Use this when you are adding new files and want to route the review to specific maintainers after preparing changes with fetch:template.
steps:
- id: fetch-template
action: fetch:template
input:
url: ./skeleton
targetPath: ./changes
values:
serviceName: ${{ parameters.serviceName }}
- id: create-feature-pr
action: publish:github:pull-request
input:
repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.repoOwner }}
branchName: feature/upgrade-java-17
targetBranchName: main
title: Upgrade service to Java 17
description: Update runtime to Java 17 and adjust Dockerfile and CI workflow
sourcePath: ./changes
commitMessage: chore: upgrade to Java 17 and update CI
reviewers:
- dev1
- dev2
assignees:
- release-manager
draft: falseCreate a draft PR from a fork with team reviewers
Opens a draft pull request from a fork using a GitHub App or personal token. Use this when write access is restricted and you need team based reviews after preparing changes with fetch:template.
steps:
- id: fetch-template
action: fetch:template
input:
url: ./ci-updates
targetPath: ./changes
values:
pipeline: github-actions
- id: pr-from-fork
action: publish:github:pull-request
input:
repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.repoOwner }}
branchName: chore/update-ci-workflows
targetBranchName: develop
title: CI workflow improvements
description: Migrate workflows to reusable actions and improve caching
sourcePath: ./changes
commitMessage: ci: refactor workflows and caching
draft: true
teamReviewers:
- platform
- security
forceFork: true
token: ${{ secrets.githubToken }}
forceEmptyGitAuthor: trueDelete obsolete files and skip empty PRs
Proposes a cleanup that removes deprecated files and updates docs, and does not open a pull request if there are no changes. Use this for periodic maintenance prepared with fetch:template.
steps:
- id: fetch-docs
action: fetch:template
input:
url: ./docs-refresh
targetPath: ./changes
values:
docOwner: ${{ parameters.repoOwner }}
- id: cleanup-docs-pr
action: publish:github:pull-request
input:
repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.repoOwner }}
branchName: docs/cleanup
targetBranchName: main
title: Remove legacy docs and refresh content
description: Delete deprecated documentation and apply latest templates
sourcePath: ./changes
targetPath: docs/
filesToDelete:
- docs/legacy.md
- docs/old-config.yml
commitMessage: docs: refresh and remove legacy files
reviewers:
- tech-writer
createWhenEmpty: falseUpdate an existing PR if the branch already exists
Ensures the same branch is reused and the pull request is updated on subsequent runs. Use this for recurring automation that regenerates files with fetch:template.
steps:
- id: fetch-updates
action: fetch:template
input:
url: ./dependency-bump
targetPath: ./changes
values:
updatePolicy: minor
- id: update-bump-pr
action: publish:github:pull-request
input:
repoUrl: github.com?repo=${{ parameters.repoName }}&owner=${{ parameters.repoOwner }}
branchName: chore/dependency-bump
targetBranchName: main
title: Dependency updates
description: Apply automated dependency updates across the project
sourcePath: ./changes
commitMessage: chore: bump dependencies
assignees:
- build-cop
update: true
draft: falseApply changes to a subdirectory in a monorepo with team review
Copies generated files into a specific package directory in a monorepo and requests review from a team and an owner. Use this when only part of the repository should be changed after preparing content with fetch:template.
steps:
- id: fetch-service-config
action: fetch:template
input:
url: ./service-config
targetPath: ./changes/service-a
values:
serviceId: service-a
language: node
- id: service-config-pr
action: publish:github:pull-request
input:
repoUrl: github.com?repo=platform-monorepo&owner=acme-org
branchName: feat/service-a-ci
targetBranchName: main
title: Add CI config for service-a
description: Introduce CI workflow and codeowners for service-a
sourcePath: ./changes/service-a
targetPath: services/service-a/
commitMessage: feat(service-a): add CI workflow and codeowners
reviewers:
- alice
teamReviewers:
- service-owners
gitAuthorName: Automation Bot
gitAuthorEmail: bot@acme.org