feat: Handle API URLs for Forgejo, Gitea, GitLab and GitHub

This commit is contained in:
jiriks74
2024-12-15 19:23:00 +01:00
committed by GitHub Actions
parent ca94b1dd42
commit b96dfd4b07
2 changed files with 39 additions and 8 deletions

View File

@@ -51,8 +51,10 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
core.startGroup('Determining the base and head repositories')
const baseRemote = gitConfigHelper.getGitRemote()
// Init the GitHub clients
const ghBranch = new GitHubHelper(baseRemote.hostname, inputs.branchToken)
const ghPull = new GitHubHelper(baseRemote.hostname, inputs.token)
const apiUrl = await GitHubHelper.determineApiUrl(baseRemote.hostname);
core.info(`Using API base URL: ${apiUrl}`);
const ghBranch = new GitHubHelper(apiUrl, inputs.branchToken)
const ghPull = new GitHubHelper(apiUrl, inputs.token)
// Determine the head repository; the target for the pull request branch
const branchRemoteName = inputs.pushToFork ? 'fork' : 'origin'
const branchRepository = inputs.pushToFork