0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-11 05:39:10 +00:00

feat(gitea)!: use Bearer instead of token for auth ()

Previous Gitea implementation used non-standard “token” auth instead of “Bearer”. Gitea supports Bearer al alternate to token since v1.8.0, so it’s safe to make this change now.

BREAKING CHANGE: Gitea platfor authentication will now be done using Bearer auth instead of token auth.
This commit is contained in:
Michael Kriese 2024-04-13 11:06:23 +02:00 committed by Rhys Arkins
parent 2ad12cc84e
commit a3e29a092d
2 changed files with 4 additions and 2 deletions
lib/util/http

View file

@ -57,7 +57,7 @@ describe('util/http/auth', () => {
expect(opts).toMatchInlineSnapshot(`
{
"headers": {
"authorization": "token XXXX",
"authorization": "Bearer XXXX",
},
"hostType": "gitea",
"token": "XXXX",

View file

@ -40,7 +40,9 @@ export function applyAuthorization<GotOptions extends AuthGotOptions>(
options.hostType &&
GITEA_API_USING_HOST_TYPES.includes(options.hostType)
) {
options.headers.authorization = `token ${options.token}`;
// Gitea v1.8.0 and later support `Bearer` as alternate to `token`
// https://github.com/go-gitea/gitea/pull/5378
options.headers.authorization = `Bearer ${options.token}`;
} else if (
options.hostType &&
GITHUB_API_USING_HOST_TYPES.includes(options.hostType)