Skip to content

Commit 21a075d

Browse files
authored
Merge pull request #114 from peter-evans/ghe
feat: add support for github enterprise
2 parents fb9c0bc + 498a871 commit 21a075d

File tree

5 files changed

+7099
-37
lines changed

5 files changed

+7099
-37
lines changed

dist/index.js

+5-13
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,9 @@ const octokit_client_1 = __nccwpck_require__(40);
274274
const util_1 = __nccwpck_require__(669);
275275
class GitHubHelper {
276276
constructor(token) {
277-
const options = {};
278-
if (token) {
279-
options.auth = `${token}`;
280-
}
281-
this.octokit = new octokit_client_1.Octokit(options);
282-
this.graphqlClient = octokit_client_1.graphql.defaults({
283-
headers: {
284-
authorization: `token ${token}`
285-
}
277+
this.octokit = new octokit_client_1.Octokit({
278+
auth: token,
279+
baseUrl: process.env['GITHUB_API_URL'] || 'https://api.github.com'
286280
});
287281
}
288282
parseRepository(repository) {
@@ -306,7 +300,7 @@ class GitHubHelper {
306300
}
307301
}
308302
}`;
309-
const collaboratorPermission = yield this.graphqlClient(query, Object.assign(Object.assign({}, repo), { collaborator: actor }));
303+
const collaboratorPermission = yield this.octokit.graphql(query, Object.assign(Object.assign({}, repo), { collaborator: actor }));
310304
core.debug(`CollaboratorPermission: ${util_1.inspect(collaboratorPermission.repository.collaborators.edges)}`);
311305
return collaboratorPermission.repository.collaborators.edges.length > 0
312306
? collaboratorPermission.repository.collaborators.edges[0].permission.toLowerCase()
@@ -576,13 +570,11 @@ run();
576570
"use strict";
577571

578572
Object.defineProperty(exports, "__esModule", ({ value: true }));
579-
exports.graphql = exports.Octokit = void 0;
573+
exports.Octokit = void 0;
580574
const core_1 = __nccwpck_require__(762);
581575
const plugin_paginate_rest_1 = __nccwpck_require__(193);
582576
const plugin_rest_endpoint_methods_1 = __nccwpck_require__(44);
583577
exports.Octokit = core_1.Octokit.plugin(plugin_paginate_rest_1.paginateRest, plugin_rest_endpoint_methods_1.restEndpointMethods);
584-
var graphql_1 = __nccwpck_require__(668);
585-
Object.defineProperty(exports, "graphql", ({ enumerable: true, get: function () { return graphql_1.graphql; } }));
586578

587579

588580
/***/ }),

0 commit comments

Comments
 (0)