Skip to content
Azure Pipelines task to create PR during a build or release
PowerShell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
task Not send draft in the body in GitHub repos when the draft is false Dec 4, 2019
.gitignore Inital commit Jul 11, 2019
LICENSE Fix license Sep 25, 2019
README.md Fixed a few typos Nov 18, 2019
azure-pipelines.yml Update azure-pipelines.yml for Azure Pipelines Dec 4, 2019
icon.png Inital commit Jul 11, 2019
vss-extension.json fixed again the json Nov 3, 2019

README.md

Build Release Extension
Build Status Release Status Extnesion

Azure DevOps Create Pull Request Task

An easy way to automatically create a Pull Request from your Build or Release Pipeline.

You can create a Pull Request to an Azure DevOps (Repos) repository or to a GitHub repository.

Support multi target branch (PR from one source branch to many target branches) and Draft Pull Request.

Choose title, description, reviewers and more.

Prerequisites

  • The task currently only works on Windows machines.

For Azure DevOps Repository:

  • You need to enable the "Allow scripts to access the OAuth token":

    • If you use the classic editor, go to the Agent job options, scroll down and check the checkbox "Allow scripts to acess the OAuth token":

      Oauth

    • If you use yaml build, you need to map the variable in the task:

       env:
         System_AccessToken: $(System.AccessToken)
  • You need to give permissions to the build user (in Microaoft hosted agnet is "Build Service (user-name)"):

    Permissions

For GitHub Repository:

Usage

In the classic editor:

Task

  • Git repository type: Azure DevOps (Repos) or GitHub. When you choose GitHub you need to choose from the list the GitHub service connection (that use PAT authorization.)

  • GitHub Connection (authorized with PAT): When you choose GitHub in Git repository type you need to specify here the GitHub service connection.

  • Source branch name: The source branch that will be merged. The default value is the build source branch - $(Build.SourceBranch).

  • Target branch name: The target branch name that the source branch will be merge to him. For example: master. Supports also multi target branch with *, for example: test/*.

  • Title: The Pull Request title.

  • Description: The Pull Request description. (Optional).

  • Reviewers: The Pull Request reviewers (Optional) .
    For Azure DevOps - one or more email address or team name separated by semicolon. For example: test@test.com;MyTeamName.
    For GitHub: one or more usernames separated by semicolon. For example: user1;user2.

  • Create Draft Pull Request: If checekd the pull request will be a Draft Pull Request. (Default: false)
    For Azure DevOps: see here more info.
    For GitHub: see here more info.

  • Set Auto Complete: Only for Azure DevOps. If checekd the pull request will close once all branch policies are met.

    Complete options:

    • Merge Strateg: Specify the strategy used to merge the pull request during completion, see here more info.
      • Merge (No fast-forward)
      • Squash commit
      • Rebase and fast-forward
      • Rebase and not fast-forward
    • Delete Sourch Branch: If true, the source branch of the pull request will be deleted after completion.
    • Commit Message: If set, this will be used as the commit message of the merge commit. if empty the default will be used.
    • Complete Associated Work Items: If true, we will attempt to transition any work items linked to the pull request into the next logical state (i.e. Active -> Resolved).

In yaml piepline:

- task: CreatePullRequest@1
  inputs:
    repoType: Azure DevOps / GitHub
    githubEndpoint: 'my-github' # When you choose GitHub in `repoType` you need to specify here the GitHub service connection
    sourceBranch: '$(Build.SourceBranch)'
    targetBranch: 'master'
    title: 'Test'
    description: 'Test' # Optional
    reviewers: For Azure DevOps: 'test@test.com;MyTeam'. For GitHub: `username;username2` # Optional
    isDraft: false / true (Default: false) # Optional
    autoComplete: false / true (Default: false) # Optional
    mergeStrategy: 'merge (default) / squash / rebase-ff / rebase-noff'
    deleteSourch:  false / true (Default: false) # Optional
    commitMessage: 'Test Comment' # Optional
    transitionWorkItems:  false / true (Default: false) # Optional
  env:
    System_AccessToken: $(System.AccessToken)

Known issue(s)

  • In Azure DevOps Server (TFS) you can't use reviewers. still can create a PR without it. [Fixed in version 1.2.18]

Release Notes

1.2.36

  • Add complete options like Merge Strategy and more in auto completion (for Azure DevOps).

1.2.30

  • Support also a Team as reviewers (for Azure DevOps).

1.2.24

  • Set Auto Complete the Pull Request (for Azure DevOps).

1.2.18

  • Bug fix: Now you can add reviewers also in TFS 2018 and Azure DevOps Server 2019.

1.2.15

  • Draft Pull Request option.

1.2.0

  • Support also GitHub repositories!

1.0.31

  • Multi target branch (For example: feature/*)

1.0.0

  • First version.
You can’t perform that action at this time.