Gitea Pull Request
Description
The gitea/pullrequest action opens (or updates) a Gitea 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 Gitea workflow: the gitea 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.
Note | kind: gitea is a deprecated alias for kind: gitea/pullrequest. It still works and logs a warning. |
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.
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| assignees | array | “assignees” defines a list of assignees for the pull request. default: No assignees are set on the pull request. remark: You can use this to assign specific users to review the pull request. Make sure the users you specify have access to the repository. | |
| body | string | “body” defines a custom body pullrequest. default: By default a pullrequest body is generated out of a pipeline execution. remark: Unless you know what you are doing, you shouldn’t set this value and rely on the sane default. “body” is useful to provide additional information when reviewing pullrequest, such as changelog url. | |
| owner | string | “owner” defines the Gitea repository owner. remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. | |
| repository | string | “repository” defines the Gitea repository for a specific owner remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. | |
| sourcebranch | string | “sourcebranch” defines the branch name used as a source to create the Gitea pullrequest. default: “sourcebranch” inherits the value from the scm branch if a scm of kind “gitea” is specified by the action. remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. | |
| targetbranch | string | “targetbranch” defines the branch name used as a target to create the Gitea pullrequest. default: “targetbranch” inherits the value from the scm working branch if a scm of kind “gitea” is specified by the action. remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. the Gitea scm will create and use a working branch such as updatecli_xxxx | |
| title | string | “title” defines the Gitea pullrequest title default: A Gitea pullrequest title is defined by one of the following location (first match) 1. title is defined by the spec such as: actions: default: kind: gitea/pullrequest scmid: default spec: title: This is my awesome title
actions: default: kind: gitea/pullrequest scmid default title: This is my awesome title
remark: usually we prefer to go with option 2 | |
| token | string | “token” specifies the credential used to authenticate with Gitea API remark: A token is a sensitive information, it’s recommended to not set this value directly in the configuration file but to use an environment variable or a SOPS file. The value can be set to For more information, about a SOPS file, please refer to the following documentation: https://github.com/getsops/sops | |
| url | string | “url” defines the Gitea url to interact with | |
| username | string | “username” defines the username used to authenticate with Gitea API |
The spec is small - title, body, and assignees, on top of the identity fields inherited from the scm. Labels, reviewers, and merge automation are not exposed by this plugin.
bodyReplaces the description Updatecli generates from the pipeline run. Useful to add context a reviewer needs, such as a changelog URL.
assigneesGitea usernames, who must have access to the repository. They are set when the pull request is created and not reapplied afterwards.
Updating an existing pull request
When a pull request is already open between the two branches, this plugin leaves it untouched - it does not refresh the title or the description with the latest run, unlike the GitHub, GitLab, Bitbucket Cloud, and Azure DevOps plugins. The report still links to it.
Warning | If the API call creating the pull request fails, for any reason, Updatecli logs |
Warning | The |
Cleanup
Cleanup is not implemented for this plugin. updatecli apply --clean-git-branches removes working branches that ended up with no changes, but a pull request already opened for one of them is not closed automatically (that stays a manual step).
The same goes for the options this plugin does not expose, such as labels and reviewers. If closing stale pull requests, or anything else missing here, is something you would use, say so on the Updatecli issue tracker (these gaps are unimplemented rather than deliberate, and interest is what gets them prioritised).
Example
# updatecli.yaml
# updatecli.yaml
# updatecli diff --config updatecli.yaml
#
name: Show Gitea pipeline example
scms:
gitea:
kind: gitea
spec:
url: "demo.gitea.com"
owner: "olblak"
repository: "updatecli-mirror"
branch: main
# Sources are responsible to fetch information from third location such as npm registry.
sources:
updatecli:
name: Get latest axios version
kind: npm
spec:
name: axios
# Targets are responsible to update targeted files such as a yaml file.
targets:
npm:
name: Update e2e test file
kind: yaml
sourceid: updatecli
scmid: gitea
spec:
file: e2e/updatecli.d/success.d/npm.yaml
key: $.conditions.axios.spec.version
# Actions such as gitlab/mergerequest is triggered if a target is updated.
actions:
default:
kind: gitea/pullrequest
scmid: gitea
title: Bump axios version