Create a PR to a repository in Azure DevOps.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| title | string | - | |
| token | string | - | |
| server | string | - | |
| project | string | - | |
| repoName | string | - | |
| workItemId | string | - | |
| description | string | - | |
| autoComplete | boolean | - | |
| organization | string | - | |
| sourceBranch | string | - | |
| targetBranch | string | - | |
| supportsIterations | boolean | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| pullRequestId | number | - |
Usage Examples
Create a PR from a feature branch into main on Azure DevOps cloud
Creates a pull request from a feature branch to main in an Azure DevOps organization. Use when a feature branch already exists and you want to open a PR programmatically after preparing files with fetch:template.
steps:
- id: fetch_base
action: fetch:template
input:
url: ./skeleton
values:
serviceName: ${{ parameters.serviceName }}
- id: create_pr
action: azure:pr:create
input:
organization: contoso
project: Platform
repoName: web-portal
sourceBranch: refs/heads/feature/add-login
targetBranch: refs/heads/main
title: "feat(login): add OAuth login flow"
description: "Implements OAuth login, updates routing, and adds tests."
token: ${{ secrets.azdoToken }}
- id: log_pr
action: debug:log
input:
message: "Created PR ID ${{ steps.create_pr.output.pullRequestId }} in contoso/Platform/web-portal"Auto-complete PR and link a work item
Opens a PR that auto-completes when policies pass and links it to a work item. Use when changes are ready and you want the PR to complete automatically after successful checks.
steps:
- id: fetch_base
action: fetch:template
input:
url: ./templates/patch
values:
ticketId: ${{ parameters.ticketId }}
- id: create_pr
action: azure:pr:create
input:
organization: contoso
project: Platform
repoName: api-gateway
sourceBranch: refs/heads/feature/refactor-authz
targetBranch: refs/heads/main
title: "refactor(authz): simplify policy evaluation"
description: "Refactors authorization middleware and updates policy tests."
autoComplete: true
workItemId: "123456"
supportsIterations: true
token: ${{ secrets.azdoToken }}
- id: log_pr
action: debug:log
input:
message: "PR ${{ steps.create_pr.output.pullRequestId }} created and set to auto-complete"Create a PR to a release branch on a self-hosted Azure DevOps Server
Creates a PR on an on-premises Azure DevOps Server instance targeting a release branch. Use when your organization hosts Azure DevOps internally.
steps:
- id: fetch_base
action: fetch:template
input:
url: ./skeleton
values:
release: "2024.10"
- id: create_pr
action: azure:pr:create
input:
server: https://ado.contoso.local/tfs
organization: DefaultCollection
project: Manufacturing
repoName: erp-gateway
sourceBranch: refs/heads/hotfix/patch-invoice-rounding
targetBranch: refs/heads/release/2024.10
title: "fix(invoice): rounding fix for edge cases"
description: "Backports rounding fix to 2024.10 release branch."
token: ${{ secrets.onpremAzdoPat }}
- id: log_pr
action: debug:log
input:
message: "Hotfix PR ${{ steps.create_pr.output.pullRequestId }} opened against release/2024.10"Parameterized branches for environment-specific PRs
Uses template parameters to choose source and target branches at runtime. Use when users select the feature and base branches in the form.
steps:
- id: fetch_base
action: fetch:template
input:
url: ./templates/config-update
values:
env: ${{ parameters.env }}
- id: create_pr
action: azure:pr:create
input:
organization: contoso
project: SRE
repoName: platform-configs
sourceBranch: refs/heads/${{ parameters.featureBranch }}
targetBranch: refs/heads/${{ parameters.baseBranch }}
title: "${{ parameters.title }}"
description: "Automated config update for ${{ parameters.env }}."
token: ${{ secrets.azdoToken }}
- id: log_pr
action: debug:log
input:
message: "Config PR ${{ steps.create_pr.output.pullRequestId }} from ${{ parameters.featureBranch }} to ${{ parameters.baseBranch }}"Create a PR with minimal fields using organization-level defaults
Opens a PR with essential fields and iterations enabled, relying on integration defaults for authentication. Use when Backstage is configured with Azure DevOps integration and you only need to supply repo, project, and branches.
steps:
- id: fetch_base
action: fetch:template
input:
url: ./templates/code-mod
values:
mod: "rename-api"
- id: create_pr
action: azure:pr:create
input:
project: DeveloperExperience
repoName: docs-portal
sourceBranch: refs/heads/chore/rename-api-endpoints
targetBranch: refs/heads/main
title: "chore: rename legacy API endpoints"
description: "Automated codemod to rename deprecated endpoints."
supportsIterations: true
- id: log_pr
action: debug:log
input:
message: "Opened PR ${{ steps.create_pr.output.pullRequestId }} in DeveloperExperience/docs-portal"