Azure DevOps Pull Request
Description
The azuredevops/pullrequest action opens (or updates) an Azure DevOps pull request once a target linked to the same scm has changed something and the change has been pushed.
It is the second half of the Azure DevOps workflow: the azuredevops scm commits to a working branch and pushes it, this action turns that branch into a pull request. Without it, the branch is pushed and nothing else happens.
The scm may be either azuredevops or azuredevopssearch; with the latter, one pull request is opened per discovered repository.
Requirements
An action never runs on its own: it needs an scmid pointing at an scm declared in the same manifest, and that scm must be of the matching kind. Both are checked when the manifest loads:
missing value for parameter(s) ["scmid"]
scm of kind "git" is not compatible with action of kind "github/pullrequest"The action then reuses that scm rather than being configured twice. From it, it inherits:
| Field | Inherited value |
|---|---|
| The working branch the scm created and pushed - the branch carrying the changes. |
| The scm’s |
| The repository the scm points at. |
credentials, URL | Whatever the scm was given, when the action does not set its own. |
Every one of these can be overridden in the action spec, but there is rarely a good reason to: a mismatch between the branch the scm pushed and the branch the action opens the request from produces a request with no changes in it.
Where the title comes from
The title is resolved from the first of these that is set:
spec.titleon the actiontitleon the action itself, one level abovespecthe name of the associated target, when there is exactly one
the pipeline name
The second form is the usual one:
actions:
default:
kind: <the action kind>
scmid: default
title: 'deps: bump axios version'Create or update
Updatecli looks for a request already open between the same two branches before creating one, so running the same pipeline repeatedly gives you one long-lived request per pipeline and repository rather than one per run. Whether that existing request is then refreshed with the latest title and description differs by plugin (each page says which).
Creation is also skipped, without failing the pipeline, when either branch is missing from the remote. Updatecli attempts it on every run regardless, so that a request closed by hand or lost to an earlier failure gets reopened on the next one.
Pipeline URL
When Updatecli detects that it runs inside a CI job, it appends a link to that job in the request description. Set disablepipelineurl: true on the action (next to kind and scmid, not inside spec) to leave it out.
Detection is limited to three engines, each recognised by one environment variable: Jenkins (JENKINS_URL), GitLab CI (GITLAB_CI), and GitHub Actions (GITHUB_ACTION), checked in that order. Anywhere else no link is added, whatever this setting says.
On top of the scm’s credentials, this action also falls back to UPDATECLI_AZURE_DEVOPS_TOKEN and UPDATECLI_AZURE_DEVOPS_USERNAME when neither its own spec nor the scm provides them. See the Azure DevOps scm authentication section.
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| body | string | “body” defines a custom pull request body. | |
| draft | boolean | “draft” defines if the pull request should be created as draft. | |
| organization | string | Organization defines the Azure DevOps organization URL to interact with. | |
| project | string | “project” defines the Azure DevOps project containing the repository. | |
| repository | string | “repository” defines the Azure DevOps repository name. | |
| sourcebranch | string | “sourcebranch” defines the source branch used to create the pull request. | |
| targetbranch | string | “targetbranch” defines the target branch used to create the pull request. | |
| title | string | “title” defines the pull request title. | |
| token | string | “token” specifies the personal access token used to authenticate with Azure DevOps. | |
| url | string | “url” defines the Azure DevOps organization URL to interact with. | |
| username | string | “username” defines the username used for git authentication. |
The spec is small - title, body, and draft, on top of the identity fields inherited from the scm. Reviewers, labels, and merge automation are not exposed here; branch policies on the target branch cover most of what they would do.
Where they do not, say so on the Updatecli issue tracker (these fields are unimplemented rather than deliberately left out, and interest is what gets them prioritised).
draftOpens the pull request as a draft, leaving it out of reviewers' queues until published.
bodyReplaces the description Updatecli generates from the pipeline run.
Cleanup
This plugin implements cleanup: on updatecli apply, a pull request that no longer carries any change is closed automatically rather than left open. Among the action plugins, only this one and github/pullrequest do so.
Example
# updatecli.yaml
name: Update a file and open an Azure DevOps Pull Request
scms:
default:
kind: azuredevops
spec:
organization: myorg
project: myproject
repository: myrepo
branch: main
token: '{{ requiredEnv "UPDATECLI_AZURE_DEVOPS_TOKEN" }}'
username: '{{ requiredEnv "UPDATECLI_AZURE_DEVOPS_USERNAME" }}'
user: updatecli
email: updatecli@example.com
sources:
golang:
name: Get the latest Golang version
kind: golang
spec:
versionfilter:
kind: semver
pattern: "1.24.x"
targets:
golang-version:
name: 'deps(golang): Bump Golang version to {{ source "golang" }}'
kind: yaml
scmid: default
spec:
file: .github/workflows/*.yaml
key: '$.jobs.build.steps[?(@.uses =~ /^actions\/setup-go/)].with.go-version'
searchpattern: true
actions:
default:
kind: azuredevops/pullrequest
scmid: default
spec:
title: 'deps(golang): Bump Golang version'