Azure Repos Pull Request

Action ID: azure:repo:pr
NPM Package:

@parfuemerie-douglas/scaffolder-backend-module-azure-repositories

Description

Create a PR to a repository in Azure DevOps.

Input Schema

PropertyTypeDescriptionRequired
titlestringThe title of the pull request.
tokenstringThe token to use for authorization.
repoIdstringRepo ID of the pull request.
serverstringThe hostname of the Azure DevOps service. Defaults to dev.azure.com
projectstringThe Project in Azure DevOps.
descriptionstringThe description of the pull request.
autoCompletebooleanEnable auto-completion of the pull request once policies are met
organizationstringThe name of the organization in Azure DevOps.
sourceBranchstringThe branch to merge into the source.
targetBranchstringThe branch to merge into (default: main).
supportsIterationsbooleanWhether or not the PR supports iterations.

Output Schema

PropertyTypeDescriptionRequired
typeany-
propertiesany-

Usage Examples

Create a PR from a feature branch to main

Creates a pull request from a feature branch into main after generating files with fetch:template. Use this when your template or prior steps have pushed commits to the feature branch.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./templates/service
      values:
        name: ${{ parameters.serviceName }}
        owner: platform

  - id: create-pr
    action: azure:repo:pr
    input:
      organization: acme-inc
      project: Retail
      repoId: 3b1a2e4f-9c12-4a7e-bc3c-84a6d0f8c7a1
      sourceBranch: feature/${{ parameters.serviceName }}
      targetBranch: main
      title: "feat: add ${{ parameters.serviceName }} service"
      description: "Initial scaffold and CI setup for ${{ parameters.serviceName }}"
      supportsIterations: true
      token: ${{ secrets.azure.token }}

Auto complete a hotfix PR into a release branch

Creates a pull request from a hotfix branch into a release branch and enables auto completion when policies pass. Use this for small, policy-gated hotfixes prepared by earlier steps.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./templates/hotfix
      values:
        issue: ${{ parameters.issueId }}
        owner: retail-team

  - id: release-pr
    action: azure:repo:pr
    input:
      organization: acme-inc
      project: Retail
      repoId: 7f9a1b22-4ce1-4a42-9f71-1d1a6b8b2e55
      sourceBranch: hotfix/${{ parameters.issueId }}-payment-retry
      targetBranch: release/1.4
      title: "fix(payment): retry on transient errors"
      description: "Hotfix for payment retries related to ${{ parameters.issueId }}"
      autoComplete: true
      supportsIterations: true
      token: ${{ parameters.azurePat }}

Create a PR on Azure DevOps Server with a custom host

Creates a pull request on an on-prem Azure DevOps Server instance. Use this when your organization hosts ADO Server with a non default hostname.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./templates/logging-update
      values:
        owner: platform
        component: shared-logging

  - id: create-pr-onprem
    action: azure:repo:pr
    input:
      server: ado.internal.corp
      organization: DefaultCollection
      project: Platform
      repoId: 2d3c4b5a-6e7f-8901-a2b3-c4d5e6f78901
      sourceBranch: feature/improve-logging
      targetBranch: main
      title: "chore(logging): standardize logging format"
      description: "Apply structured logging and update pipeline config"
      supportsIterations: false
      token: ${{ secrets.azure.serverToken }}

Create a PR targeting a develop branch

Creates a pull request into develop instead of the default main. Use this for trunk based workflows where develop is the integration branch.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./templates/microservice
      values:
        name: ${{ parameters.serviceName }}
        domain: catalogue

  - id: pr-to-develop
    action: azure:repo:pr
    input:
      organization: acme-inc
      project: Services
      repoId: e1c2d3f4-a5b6-7890-c1d2-e3f4a5b67890
      sourceBranch: feature/${{ parameters.serviceName }}-catalog
      targetBranch: develop
      title: "feat(${{ parameters.serviceName }}): initial service skeleton"
      description: "Scaffolded service, added linting and basic health endpoint"
      supportsIterations: true

Create a PR for an automated dependency update branch

Creates a pull request for an automated dependency update branch and enables iterations to support review updates. Use this when prior automation has pushed dependency changes.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./templates/dependency-update
      values:
        owner: sre
        tool: renovate

  - id: dep-update-pr
    action: azure:repo:pr
    input:
      organization: acme-inc
      project: Web
      repoId: 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
      sourceBranch: renovate/npm-typescript-5.x
      targetBranch: main
      title: "chore(deps): update typescript to v5"
      description: "Automated dependency update generated by Renovate"
      supportsIterations: true
      autoComplete: false