Group reviewer bot #18

Closed
opened 2025-03-28 00:33:34 +01:00 by adamm · 3 comments
Owner

Need bot to represents groups for reviews

Need bot to represents groups for reviews
adamm added this to the Devel project (default issues) project 2025-03-28 00:33:34 +01:00
adamm moved this to In Progress in Devel project (default issues) on 2025-03-28 00:33:37 +01:00
Owner

Issues found so far

typo in the -internval option

lack of http support

  • I use -gitea-host localhost:3000 in my test instance
  • ERROR: Cannot fetch review user: %w Get "https://localhost:3000/api/v1/user": http: server gave HTTP response to HTTPS client
  • it might make sense to replace -gitea-host with -gitea-url or -gitea-root-url and also accept the http:// protocol

Workaround patch:

diff --git a/common/gitea_utils.go b/common/gitea_utils.go
index fdd0324..3ba29ee 100644
--- a/common/gitea_utils.go
+++ b/common/gitea_utils.go
@@ -142,7 +142,7 @@ type GiteaTransport struct {
 func AllocateGiteaTransport(host string) Gitea {
        var r GiteaTransport
 
-       r.transport = transport.New(host, apiclient.DefaultBasePath, [](string){"https"})
+       r.transport = transport.New(host, apiclient.DefaultBasePath, [](string){"http"})
        r.transport.DefaultAuthentication = transport.BearerToken(giteaToken)
 
        r.client = apiclient.New(r.transport, nil)
diff --git a/devel-importer/main.go b/devel-importer/main.go
index b858cf1..97e2efe 100644
--- a/devel-importer/main.go
+++ b/devel-importer/main.go
@@ -838,7 +838,7 @@ func main() {
                return
        }
 
-       r = transport.New(*giteaHost, apiclient.DefaultBasePath, [](string){"https"})
+       r = transport.New(*giteaHost, apiclient.DefaultBasePath, [](string){"http"})
        r.DefaultAuthentication = transport.BearerToken(common.GetGiteaToken())
        // r.SetDebug(true)
        client = apiclient.New(r, nil)

notes from running the bot

Running:

AMQP_USERNAME=guest AMQP_PASSWORD=guest GITEA_TOKEN=1111111111111111111111111111111111111111 ./group-review -gitea-url http://localhost:3000 -rabbit-host localhost -interval 1 -config conf autobuild
  • the autobuild group exists in test-org organization
  • the token belongs to the Admin account in my test instance
2025/04/08 13:40:22 Missing org/repo in projectgit: http://localhost:3000/test-org/_ObsPrj
2025/04/08 13:40:22 Cannot fetch review user: %w [GET /user] userGetCurrent (status 404): {}

Changed the conf file contents from ["http://localhost:3000/test-org/_ObsPrj"] to ["test-org"]

2025/04/08 13:50:51 Error fetching 'workflow.config' for test-org/_ObsPrj#: [GET /repos/{owner}/{repo}/contents/{filepath}][404] repoGetContentsNotFound
2025/04/08 13:50:51 Cannot fetch review user: %w [GET /user] userGetCurrent (status 404): {}
panic: Cannot fetch review user: %w [GET /user] userGetCurrent (status 404): {}
# Issues found so far ## typo in the `-internval` option ## lack of http support - I use `-gitea-host localhost:3000` in my test instance - ERROR: `Cannot fetch review user: %w Get "https://localhost:3000/api/v1/user": http: server gave HTTP response to HTTPS client` - it might make sense to replace `-gitea-host` with `-gitea-url` or `-gitea-root-url` and also accept the `http://` protocol Workaround patch: ``` diff --git a/common/gitea_utils.go b/common/gitea_utils.go index fdd0324..3ba29ee 100644 --- a/common/gitea_utils.go +++ b/common/gitea_utils.go @@ -142,7 +142,7 @@ type GiteaTransport struct { func AllocateGiteaTransport(host string) Gitea { var r GiteaTransport - r.transport = transport.New(host, apiclient.DefaultBasePath, [](string){"https"}) + r.transport = transport.New(host, apiclient.DefaultBasePath, [](string){"http"}) r.transport.DefaultAuthentication = transport.BearerToken(giteaToken) r.client = apiclient.New(r.transport, nil) diff --git a/devel-importer/main.go b/devel-importer/main.go index b858cf1..97e2efe 100644 --- a/devel-importer/main.go +++ b/devel-importer/main.go @@ -838,7 +838,7 @@ func main() { return } - r = transport.New(*giteaHost, apiclient.DefaultBasePath, [](string){"https"}) + r = transport.New(*giteaHost, apiclient.DefaultBasePath, [](string){"http"}) r.DefaultAuthentication = transport.BearerToken(common.GetGiteaToken()) // r.SetDebug(true) client = apiclient.New(r, nil) ``` ## notes from running the bot Running: ``` AMQP_USERNAME=guest AMQP_PASSWORD=guest GITEA_TOKEN=1111111111111111111111111111111111111111 ./group-review -gitea-url http://localhost:3000 -rabbit-host localhost -interval 1 -config conf autobuild ``` - the `autobuild` group exists in `test-org` organization - the token belongs to the `Admin` account in my test instance ``` 2025/04/08 13:40:22 Missing org/repo in projectgit: http://localhost:3000/test-org/_ObsPrj 2025/04/08 13:40:22 Cannot fetch review user: %w [GET /user] userGetCurrent (status 404): {} ``` Changed the conf file contents from `["http://localhost:3000/test-org/_ObsPrj"]` to `["test-org"]` ``` 2025/04/08 13:50:51 Error fetching 'workflow.config' for test-org/_ObsPrj#: [GET /repos/{owner}/{repo}/contents/{filepath}][404] repoGetContentsNotFound 2025/04/08 13:50:51 Cannot fetch review user: %w [GET /user] userGetCurrent (status 404): {} panic: Cannot fetch review user: %w [GET /user] userGetCurrent (status 404): {} ```
Author
Owner

-gitea-url is probably better here then

-gitea-url is probably better here then
adamm moved this to Done in Devel project (default issues) on 2025-04-07 15:04:22 +02:00
Author
Owner

I'll close this as completed. There's an upstream bug that needs addressing, where reviews are not marked as stale when new commits are pushed to a PR.

https://github.com/go-gitea/gitea/issues/34134

I'll close this as completed. There's an upstream bug that needs addressing, where reviews are not marked as stale when new commits are pushed to a PR. https://github.com/go-gitea/gitea/issues/34134
adamm closed this issue 2025-04-08 13:34:52 +02:00
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: git-workflow/autogits#18
No description provided.