Build | Release | Extension |
---|---|---|
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.
- The task currently only works on Windows machines.
-
You need to enable the "Allow scripts to access the OAuth token":
-
You need to give permissions to the build user (in Microsoft hosted agnet is "Build Service (user-name)"):
-
You need to create a GitHub service connection with Personal Access Token (PAT) - with
repo
permissions: -
To create the GitHub PAT go to https://github.com/settings/tokens/new
In the classic editor:
-
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:[email protected];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. -
Link Work Items: If checked, all the work items that linked to the commits will be linked also to the PullRequest.
-
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) -
noFastForward
in yaml:A two-parent, no-fast-forward merge. The source branch is unchanged. This is the default behavior.
-
Squash commit -
squash
in yaml:Put all changes from the pull request into a single-parent commit.
-
Rebase and fast-forward -
rebase
in yaml:Rebase the source branch on top of the target branch HEAD commit, and fast-forward the target branch. The source branch is updated during the rebase operation.
-
Rebase and not fast-forward -
rebaseMerge
in yaml:Rebase the source branch on top of the target branch HEAD commit, and create a two-parent, no-fast-forward merge. The source branch is updated during the rebase operation.
-
- 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).
- Merge Strateg: Specify the strategy used to merge the pull request during completion, see here more info.
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: '[email protected];MyTeam'. For GitHub: `username;username2` # Optional
isDraft: false / true (Default: false)
linkWorkItems: false / true (Default: true)
autoComplete: false / true (Default: false)
mergeStrategy: 'noFastForward (default) / squash / rebase / rebaseMerge'
deleteSourch: false / true (Default: false) # Optional
commitMessage: 'Test Comment' # Optional
transitionWorkItems: false / true (Default: false) # Optional
env:
System_AccessToken: $(System.AccessToken)
In Azure DevOps Server (TFS) you can't use reviewers. still can create a PR without it.[Fixed in version 1.2.18]
- Link associated work items to the PR (for Azure DevOps)
- Add complete options like Merge Strategy and more in auto completion (for Azure DevOps).
- Support also a Team as reviewers (for Azure DevOps).
- Set Auto Complete the Pull Request (for Azure DevOps).
- Bug fix: Now you can add reviewers also in TFS 2018 and Azure DevOps Server 2019.
- Draft Pull Request option.
- Support also GitHub repositories!
- Multi target branch (For example:
feature/*
)
- First version.