UNPKG

@airbnb/nimbus

Version:

Centralized CLI for JavaScript and TypeScript dev tools.

25 lines (24 loc) 792 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const rest_1 = require("@octokit/rest"); const constants_1 = require("../constants"); function createGitHubClient(token) { const { GITHUB_TOKEN, GHE_API_URL, GHE_VERSION } = process.env; const options = { auth: '', baseUrl: '', userAgent: `Nimbus v${constants_1.VERSION}`, }; if (token || GITHUB_TOKEN) { options.auth = `token ${token || GITHUB_TOKEN}`; } if (GHE_API_URL) { options.baseUrl = GHE_API_URL; } if (GHE_VERSION) { // eslint-disable-next-line rest_1.Octokit.plugin(require(`@octokit/plugin-enterprise-rest/ghe-${GHE_VERSION}`)); } return new rest_1.Octokit(options); } exports.default = createGitHubClient;