Skip to content

Commit

Permalink
upgrade to v3.5.2: merge branch 'main' from actions/checkout into col…
Browse files Browse the repository at this point in the history
…dfusionjp/main

* main:
Release v3.5.2 (actions#1291)
Fix: convert baseUrl to serverApiUrl 'formatted' (actions#1289)
  • Loading branch information
falken42 committed Apr 18, 2023
1 parent 3025d72 commit 42409b7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog

## v3.5.2
- [Fix api endpoint for GHES](https://github.com/actions/checkout/pull/1289)

## v3.5.1
- [Fix slow checkout on Windows](https://github.com/actions/checkout/pull/1246)

Expand Down
11 changes: 8 additions & 3 deletions dist/index.js
Expand Up @@ -1503,6 +1503,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* () {
Expand Down Expand Up @@ -1563,7 +1564,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
Expand Down Expand Up @@ -1595,7 +1598,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;
Expand Down Expand Up @@ -2081,7 +2086,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({
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "checkout-plus",
"version": "3.5.1",
"version": "3.5.2",
"description": "Checkout Plus action",
"main": "lib/main.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions src/github-api-helper.ts
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 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/*'

Expand Down Expand Up @@ -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=${
Expand Down

0 comments on commit 42409b7

Please sign in to comment.