File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 11import { isNonEmptyString , isString } from '@sindresorhus/is' ;
22import type { Options } from 'got' ;
33import {
4+ FORGEJO_API_USING_HOST_TYPES ,
45 GITEA_API_USING_HOST_TYPES ,
56 GITHUB_API_USING_HOST_TYPES ,
67 GITLAB_API_USING_HOST_TYPES ,
@@ -36,6 +37,11 @@ export function applyAuthorization<GotOptions extends AuthGotOptions>(
3637 } else {
3738 options . headers . authorization = `${ authType } ${ options . token } ` ;
3839 }
40+ } else if (
41+ options . hostType &&
42+ FORGEJO_API_USING_HOST_TYPES . includes ( options . hostType )
43+ ) {
44+ options . headers . authorization = `Bearer ${ options . token } ` ;
3945 } else if (
4046 options . hostType &&
4147 GITEA_API_USING_HOST_TYPES . includes ( options . hostType )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { GlobalConfig } from '../../config/global';
33import {
44 BITBUCKET_API_USING_HOST_TYPES ,
55 BITBUCKET_SERVER_API_USING_HOST_TYPES ,
6+ FORGEJO_API_USING_HOST_TYPES ,
67 GITEA_API_USING_HOST_TYPES ,
78 GITHUB_API_USING_HOST_TYPES ,
89 GITLAB_API_USING_HOST_TYPES ,
@@ -125,6 +126,21 @@ export function findMatchingRule<GotOptions extends HostRulesGotOptions>(
125126 } ;
126127 }
127128
129+ // Fallback to `forgejo` hostType
130+ if (
131+ hostType &&
132+ FORGEJO_API_USING_HOST_TYPES . includes ( hostType ) &&
133+ hostType !== 'forgejo'
134+ ) {
135+ res = {
136+ ...hostRules . find ( {
137+ hostType : 'forgejo' ,
138+ url,
139+ } ) ,
140+ ...res ,
141+ } ;
142+ }
143+
128144 // Fallback to `gitea` hostType
129145 if (
130146 hostType &&
You can’t perform that action at this time.
0 commit comments