Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src/ref-helper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/ref-helper.ts')
-rw-r--r--src/ref-helper.ts18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/ref-helper.ts b/src/ref-helper.ts
index 209f49d..ce875fc 100644
--- a/src/ref-helper.ts
+++ b/src/ref-helper.ts
@@ -1,7 +1,8 @@
-import {URL} from 'url'
import {IGitCommandManager} from './git-command-manager'
import * as core from '@actions/core'
import * as github from '@actions/github'
+import {getOctokit} from './octokit-provider'
+import {isGhes} from './url-helper'
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
@@ -183,11 +184,12 @@ export async function checkCommitInfo(
repositoryOwner: string,
repositoryName: string,
ref: string,
- commit: string
+ commit: string,
+ baseUrl?: string
): Promise<void> {
try {
// GHES?
- if (isGhes()) {
+ if (isGhes(baseUrl)) {
return
}
@@ -243,7 +245,8 @@ export async function checkCommitInfo(
core.debug(
`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`
)
- const octokit = new github.GitHub(token, {
+ const octokit = getOctokit(token, {
+ baseUrl: baseUrl,
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload(
'number'
)};run_id=${
@@ -276,10 +279,3 @@ function select(obj: any, path: string): any {
const key = path.substr(0, i)
return select(obj[key], path.substr(i + 1))
}
-
-function isGhes(): boolean {
- const ghUrl = new URL(
- process.env['GITHUB_SERVER_URL'] || 'https://github.com'
- )
- return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'
-}