feat: add --git-client to explicitly set the type of forge (#106)

codeberg is running Forgejo and it may not be possible to infer that
from the URL alone. The same is true for GitHub Enterprise Server.
This commit is contained in:
Earl Warren 2024-03-23 17:13:14 +01:00 committed by GitHub
parent 646d8fe41c
commit 80a0b554f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 70 additions and 3 deletions

View file

@ -60,7 +60,12 @@ export default class Runner {
}
// 2. init git service
const gitClientType: GitClientType = inferGitClient(args.pullRequest);
let gitClientType: GitClientType;
if (args.gitClient === undefined) {
gitClientType = inferGitClient(args.pullRequest);
} else {
gitClientType = args.gitClient as GitClientType;
}
// the api version is ignored in case of github
const apiUrl = inferGitApiUrl(args.pullRequest, gitClientType === GitClientType.CODEBERG ? "v1" : undefined);
const token = this.fetchToken(args, gitClientType);