Skip to content

Commit

Permalink
Add support for GitHub Enterprise (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
retiman authored Aug 19, 2021
1 parent 85a4385 commit 516ef60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-app-token",
"version": "1.3.0",
"version": "1.4.0",
"license": "MIT",
"files": [
"action.yml",
Expand Down
13 changes: 11 additions & 2 deletions src/fetch-installation-token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { context, getOctokit } from "@actions/github";
import { getOctokit } from "@actions/github";
import { createAppAuth } from "@octokit/auth-app";
import { request } from "@octokit/request";

export const fetchInstallationToken = async ({
appId,
Expand All @@ -12,7 +13,15 @@ export const fetchInstallationToken = async ({
privateKey: string;
repo: string;
}>): Promise<string> => {
const app = createAppAuth({ appId, privateKey });
const app = createAppAuth({
appId,
privateKey,
request: request.defaults({
// GITHUB_API_URL is part of GitHub Actions' built-in environment variables.
// See https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables.
baseUrl: process.env["GITHUB_API_URL"]
})
});
const authApp = await app({ type: "app" });
const octokit = getOctokit(authApp.token);
const {
Expand Down

0 comments on commit 516ef60

Please sign in to comment.