+
Skip to content

Conversation

localleon
Copy link
Contributor

@localleon localleon commented Sep 20, 2025

This is still work in progress!!

Description:

Migrate Gitea Pull Request Action to official SDK and add reviewers field support

Fix #6081

This pull request enhances the Gitea Pull Request Action to support a assignees field, bringing feature parity with the GitHub Pull Request Action. The changes include:

  • Migration to the official Gitea SDK for better maintainability and performance
  • Addition of assignes field to allow specifying reviewers when creating pull requests
  • Updated documentation and examples to reflect the new functionality
  • This addresses the feature gap where Gitea users couldn't automatically set reviewers when opening pull requests through updatecli, unlike GitHub users who already had this capability.

Test

To test this pull request, you can use the following file with the "updatecli" repository pushed to an Gitea instance!

# updatecli.yaml
# updatecli diff --config updatecli.yaml
#
name: Show Gitea pipeline example

scms:
  gitea:
    kind: gitea
    spec:
      url: "gitea.com"
      username: "localleon"
      token: "TOKENN"
      owner: "localleon"
      repository: "test"
      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
    spec: 
      assignees:
        - localleon

Build the binary and then run "updatecli apply --config CONFIG" with the above file.

Currently tested scenarios:

  • The new SDK code creates the Pull Request like the previous code!

Additional Information

Tradeoff

The migration to the official SDK may introduce slight changes in behavior or error handling compared to the previous implementation. However, this is acceptable as it provides better long-term maintainability and access to the latest Gitea API features.

Potential improvement

  • Explore adding assignees field support similar to the reviewers implementation
  • Add validation for reviewer usernames to provide better error messages

Status: Work in Progress - Migration to official SDK completed, reviewers field implementation in progress

@localleon
Copy link
Contributor Author

Assignes now can be set when creating a Gitea PR, for the Reviewers field we still need a patch in the official go-sdk of gitea (https://gitea.com/gitea/go-sdk/pulls/730)

@localleon
Copy link
Contributor Author

@olblak please take a first look at the implementation. I currently want to keep this WIP while waiting for the SDK-PR

@olblak
Copy link
Member

olblak commented Sep 20, 2025

Thanks for the quick PR.
The documentation is located at https://github.com/updatecli/website/blob/master/content/en/docs/plugins/scm/gitea.adoc

Regarding the table parameter, it's automatically generated by on the Jsonschema which is automatically generated based on the spec comments that you updated https://github.com/updatecli/updatecli/pull/6084/files#diff-2ce45b650dadceed4e695a15d9a3d384861b555efc9f7e4f0c44942b1b6873b7

@olblak
Copy link
Member

olblak commented Sep 20, 2025

Nice, I didn't have the time to test it yet but looking at the code it's already a nice improvement

@olblak olblak added enhancement New feature or request gitea-pullrequest labels Sep 20, 2025
@localleon localleon changed the title WIP: Add reviewers field support to Gitea Pull Request Action to achieve parity with GitHub implementation Add assignee field support to Gitea Pull Request Action to achieve parity with GitHub implementation Sep 22, 2025
@localleon
Copy link
Contributor Author

localleon commented Sep 22, 2025

@olblak let's start with the "assignee" field to get this rewrite going! If the "reviewers" becomes available via the SDK i can open another PR. Please take a look at the code if possible :-)

I also corrected the example in the Docs repository to work with the kind: gitea/pullrequest

@olblak
Copy link
Member

olblak commented Sep 22, 2025

Once again, thanks for the pr, I just tested it works as expected.

While you are at this, do you think it would make sense to allow configuring "labels", "milestone", and "deadline"
Looking at the gitea sdk, it seems straightfoward

=> https://pkg.go.dev/code.gitea.io/sdk/gitea#CreatePullRequestOption

Otherwise, I am happy to merge as it is and trigger a release

@olblak olblak merged commit 27cd5ae into updatecli:main Sep 22, 2025
5 of 9 checks passed
@localleon
Copy link
Contributor Author

@olblak thanks for merging and the quick/friendly responses! If i added the "reviewers" field, i will do the rest. Currently a bit packed with work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gitea-pullrequest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add reviewers field to Gitea Pull Request Action

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载