From 566ec5e8317909e3cb11c0ba9a8338b39edf3e48 Mon Sep 17 00:00:00 2001 From: 7Hazard Date: Tue, 29 Aug 2023 00:46:33 +0200 Subject: [PATCH] Get GitHub API URL from env var --- dist/main.cjs | 3 ++- lib/main.js | 4 ++++ lib/post.js | 6 +++++- package-lock.json | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dist/main.cjs b/dist/main.cjs index ebaec51..c081205 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -15061,7 +15061,8 @@ async function main(appId2, privateKey2, repository2, core3, createAppAuth2, req repo, headers: { authorization: `bearer ${appAuthentication.token}` - } + }, + baseUrl: process.env["GITHUB_API_URL"] } ); const authentication = await auth({ diff --git a/lib/main.js b/lib/main.js index 977fcf8..9469fd8 100644 --- a/lib/main.js +++ b/lib/main.js @@ -4,6 +4,10 @@ import core from "@actions/core"; import { createAppAuth } from "@octokit/auth-app"; import { request } from "@octokit/request"; +request.defaults({ + baseUrl: process.env["GITHUB_API_URL"], +}); + /** * @param {string} appId * @param {string} privateKey diff --git a/lib/post.js b/lib/post.js index a0efe15..7c702fa 100644 --- a/lib/post.js +++ b/lib/post.js @@ -3,6 +3,10 @@ import core from "@actions/core"; import { request } from "@octokit/request"; +request.defaults({ + baseUrl: process.env["GITHUB_API_URL"], +}); + /** * @param {core} core * @param {request} request @@ -11,7 +15,7 @@ export async function post(core, request) { const token = core.getState("token"); if (!token) return; - + await request("DELETE /installation/token", { headers: { authorization: `token ${token}`, diff --git a/package-lock.json b/package-lock.json index d432973..b24fbb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-github-app-token", - "version": "1.0.5", + "version": "1.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "create-github-app-token", - "version": "1.0.5", + "version": "1.1.5", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0",