Let getLatestRelease() always query github.com.

This should allow GitHub Enterprise users to use this action.

Resolves #26, resolves #27.
This commit is contained in:
Fabio Niephaus 2022-12-13 09:12:43 +01:00
parent 778af55c2a
commit 7c84ab1ba7
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
3 changed files with 12 additions and 12 deletions

8
dist/cleanup/index.js generated vendored
View File

@ -74415,9 +74415,9 @@ const fs_1 = __nccwpck_require__(7147);
const core_1 = __nccwpck_require__(6762);
const crypto_1 = __nccwpck_require__(6113);
const path_1 = __nccwpck_require__(1017);
// Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com';
const GitHub = core_1.Octokit.defaults({
// Set up Octokit for github.com only and in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = 'https://api.github.com';
const GitHubDotCom = core_1.Octokit.defaults({
baseUrl,
request: {
agent: new httpClient.HttpClient().getAgent(baseUrl)
@ -74438,7 +74438,7 @@ function getLatestRelease(repo) {
return __awaiter(this, void 0, void 0, function* () {
const githubToken = getGitHubToken();
const options = githubToken.length > 0 ? { auth: githubToken } : {};
const octokit = new GitHub(options);
const octokit = new GitHubDotCom(options);
return (yield octokit.request('GET /repos/{owner}/{repo}/releases/latest', {
owner: c.GRAALVM_GH_USER,
repo

8
dist/main/index.js generated vendored
View File

@ -75162,9 +75162,9 @@ const fs_1 = __nccwpck_require__(7147);
const core_1 = __nccwpck_require__(6762);
const crypto_1 = __nccwpck_require__(6113);
const path_1 = __nccwpck_require__(1017);
// Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com';
const GitHub = core_1.Octokit.defaults({
// Set up Octokit for github.com only and in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = 'https://api.github.com';
const GitHubDotCom = core_1.Octokit.defaults({
baseUrl,
request: {
agent: new httpClient.HttpClient().getAgent(baseUrl)
@ -75185,7 +75185,7 @@ function getLatestRelease(repo) {
return __awaiter(this, void 0, void 0, function* () {
const githubToken = getGitHubToken();
const options = githubToken.length > 0 ? { auth: githubToken } : {};
const octokit = new GitHub(options);
const octokit = new GitHubDotCom(options);
return (yield octokit.request('GET /repos/{owner}/{repo}/releases/latest', {
owner: c.GRAALVM_GH_USER,
repo

View File

@ -9,9 +9,9 @@ import {Octokit} from '@octokit/core'
import {createHash} from 'crypto'
import {join} from 'path'
// Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'
const GitHub = Octokit.defaults({
// Set up Octokit for github.com only and in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = 'https://api.github.com'
const GitHubDotCom = Octokit.defaults({
baseUrl,
request: {
agent: new httpClient.HttpClient().getAgent(baseUrl)
@ -38,7 +38,7 @@ export async function getLatestRelease(
): Promise<c.LatestReleaseResponse['data']> {
const githubToken = getGitHubToken()
const options = githubToken.length > 0 ? {auth: githubToken} : {}
const octokit = new GitHub(options)
const octokit = new GitHubDotCom(options)
return (
await octokit.request('GET /repos/{owner}/{repo}/releases/latest', {
owner: c.GRAALVM_GH_USER,