Skip to content

Commit

Permalink
fix(gitea): allow overriding platform version (#34019)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Feb 4, 2025
1 parent 0340215 commit df1af91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/usage/self-hosted-experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ If set to any value, Renovate will download `nupkg` files for determining packag

## `RENOVATE_X_PLATFORM_VERSION`

Specify this string for Renovate to skip API checks and provide GitLab/Bitbucket server version directly.
Specify this string for Renovate to skip API checks and provide GitLab/Gitea and Forgejo/Bitbucket server version directly.
Particularly useful with GitLab's `CI_JOB_TOKEN` to authenticate Renovate or to reduce API calls for Bitbucket.

Read [platform details](modules/platform/gitlab/index.md) to learn why we need the server version on GitLab.
Expand Down
10 changes: 9 additions & 1 deletion lib/modules/platform/gitea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,18 @@ const platform: Platform = {
gitAuthor = `${user.full_name ?? user.username} <${user.email}>`;
botUserID = user.id;
botUserName = user.username;
defaults.version = await helper.getVersion({ token });
// istanbul ignore if: experimental feature
if (semver.valid(process.env.RENOVATE_X_PLATFORM_VERSION)) {
defaults.version = process.env.RENOVATE_X_PLATFORM_VERSION!;
} else {
defaults.version = await helper.getVersion({ token });
}
if (defaults.version?.includes('gitea-')) {
defaults.isForgejo = true;
}
logger.debug(
`${defaults.isForgejo ? 'Forgejo' : 'Gitea'} version: ${defaults.version}`,
);
} catch (err) {
logger.debug(
{ err },
Expand Down

0 comments on commit df1af91

Please sign in to comment.