mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 08:56:29 +00:00
Add gitea/forgejo driver check, to handle ErrUnknownVersion error (#3243)
close #3240
This commit is contained in:
parent
b24970f358
commit
8ca51971be
1 changed files with 2 additions and 1 deletions
|
@ -586,7 +586,8 @@ func (c *Gitea) newClientToken(ctx context.Context, token string) (*gitea.Client
|
|||
}
|
||||
}
|
||||
client, err := gitea.NewClient(c.url, gitea.SetToken(token), gitea.SetHTTPClient(httpClient), gitea.SetContext(ctx))
|
||||
if err != nil && strings.Contains(err.Error(), "Malformed version") {
|
||||
if err != nil &&
|
||||
(errors.Is(err, &gitea.ErrUnknownVersion{}) || strings.Contains(err.Error(), "Malformed version")) {
|
||||
// we guess it's a dev gitea version
|
||||
log.Error().Err(err).Msgf("could not detect gitea version, assume dev version %s", giteaDevVersion)
|
||||
client, err = gitea.NewClient(c.url, gitea.SetGiteaVersion(giteaDevVersion), gitea.SetToken(token), gitea.SetHTTPClient(httpClient), gitea.SetContext(ctx))
|
||||
|
|
Loading…
Reference in a new issue