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
diff options
context:
space:
mode:
authorFerenc Hammerl <31069338+fhammerl@users.noreply.github.com>2023-04-13 14:25:50 +0200
committerGitHub <noreply@github.com>2023-04-13 14:25:50 +0200
commit473c63f4d32bc90f0653642c05f1599d6f1fc97a (patch)
tree9428cfe5f2d0fc3c989e4ceab103bb8868c41b3f
parentf5ef935a2651bd991c6e6a2299e89435f5b21121 (diff)
Fix: convert baseUrl to serverApiUrl 'formatted' (#1289)
* fix: convert baseUrl to apiUrl * Run prettier --------- Co-authored-by: 1newsr <1newsr@users.noreply.github.com>
-rw-r--r--dist/index.js11
-rw-r--r--src/github-api-helper.ts9
-rw-r--r--src/ref-helper.ts4
3 files changed, 17 insertions, 7 deletions
diff --git a/dist/index.js b/dist/index.js
index 00db935..1b418d7 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1453,6 +1453,7 @@ const path = __importStar(__nccwpck_require__(1017));
const retryHelper = __importStar(__nccwpck_require__(2155));
const toolCache = __importStar(__nccwpck_require__(7784));
const v4_1 = __importDefault(__nccwpck_require__(824));
+const url_helper_1 = __nccwpck_require__(9437);
const IS_WINDOWS = process.platform === 'win32';
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
return __awaiter(this, void 0, void 0, function* () {
@@ -1513,7 +1514,9 @@ function getDefaultBranch(authToken, owner, repo, baseUrl) {
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
var _a;
core.info('Retrieving the default branch name');
- const octokit = github.getOctokit(authToken, { baseUrl: baseUrl });
+ const octokit = github.getOctokit(authToken, {
+ baseUrl: (0, url_helper_1.getServerApiUrl)(baseUrl)
+ });
let result;
try {
// Get the default branch from the repo info
@@ -1545,7 +1548,9 @@ function getDefaultBranch(authToken, owner, repo, baseUrl) {
exports.getDefaultBranch = getDefaultBranch;
function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
return __awaiter(this, void 0, void 0, function* () {
- const octokit = github.getOctokit(authToken, { baseUrl: baseUrl });
+ const octokit = github.getOctokit(authToken, {
+ baseUrl: (0, url_helper_1.getServerApiUrl)(baseUrl)
+ });
const download = IS_WINDOWS
? octokit.rest.repos.downloadZipballArchive
: octokit.rest.repos.downloadTarballArchive;
@@ -2026,7 +2031,7 @@ function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref
if (actualHeadSha !== expectedHeadSha) {
core.debug(`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`);
const octokit = github.getOctokit(token, {
- baseUrl: baseUrl,
+ baseUrl: (0, url_helper_1.getServerApiUrl)(baseUrl),
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload('number')};run_id=${process.env['GITHUB_RUN_ID']};expected_head_sha=${expectedHeadSha};actual_head_sha=${actualHeadSha})`
});
yield octokit.rest.repos.get({
diff --git a/src/github-api-helper.ts b/src/github-api-helper.ts
index 86632f5..b6bfc13 100644
--- a/src/github-api-helper.ts
+++ b/src/github-api-helper.ts
@@ -7,6 +7,7 @@ import * as path from 'path'
import * as retryHelper from './retry-helper'
import * as toolCache from '@actions/tool-cache'
import {default as uuid} from 'uuid/v4'
+import {getServerApiUrl} from './url-helper'
const IS_WINDOWS = process.platform === 'win32'
@@ -84,7 +85,9 @@ export async function getDefaultBranch(
): Promise<string> {
return await retryHelper.execute(async () => {
core.info('Retrieving the default branch name')
- const octokit = github.getOctokit(authToken, {baseUrl: baseUrl})
+ const octokit = github.getOctokit(authToken, {
+ baseUrl: getServerApiUrl(baseUrl)
+ })
let result: string
try {
// Get the default branch from the repo info
@@ -125,7 +128,9 @@ async function downloadArchive(
commit: string,
baseUrl?: string
): Promise<Buffer> {
- const octokit = github.getOctokit(authToken, {baseUrl: baseUrl})
+ const octokit = github.getOctokit(authToken, {
+ baseUrl: getServerApiUrl(baseUrl)
+ })
const download = IS_WINDOWS
? octokit.rest.repos.downloadZipballArchive
: octokit.rest.repos.downloadTarballArchive
diff --git a/src/ref-helper.ts b/src/ref-helper.ts
index 9b1ca95..1c25049 100644
--- a/src/ref-helper.ts
+++ b/src/ref-helper.ts
@@ -1,7 +1,7 @@
import {IGitCommandManager} from './git-command-manager'
import * as core from '@actions/core'
import * as github from '@actions/github'
-import {isGhes} from './url-helper'
+import {getServerApiUrl, isGhes} from './url-helper'
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
@@ -245,7 +245,7 @@ export async function checkCommitInfo(
`Expected head sha ${expectedHeadSha}; actual head sha ${actualHeadSha}`
)
const octokit = github.getOctokit(token, {
- baseUrl: baseUrl,
+ baseUrl: getServerApiUrl(baseUrl),
userAgent: `actions-checkout-tracepoint/1.0 (code=STALE_MERGE;owner=${repositoryOwner};repo=${repositoryName};pr=${fromPayload(
'number'
)};run_id=${