Enable support for GitHub Enterprise Server
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
import {Octokit} from "@octokit/rest";
|
import {Octokit} from "@octokit/rest";
|
||||||
|
|
||||||
export function getClient(token: string, userAgent?: string): Octokit {
|
export function getClient(token: string, userAgent?: string, apiUrl?: string): Octokit {
|
||||||
return new Octokit({
|
return new Octokit({
|
||||||
auth: token,
|
auth: token,
|
||||||
userAgent: userAgent || `GitHub Actions Language Server`
|
userAgent: userAgent || `GitHub Actions Language Server`,
|
||||||
|
baseUrl: apiUrl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export function initConnection(connection: Connection) {
|
|||||||
const options = params.initializationOptions as InitializationOptions;
|
const options = params.initializationOptions as InitializationOptions;
|
||||||
|
|
||||||
if (options.sessionToken) {
|
if (options.sessionToken) {
|
||||||
client = getClient(options.sessionToken, options.userAgent);
|
client = getClient(options.sessionToken, options.userAgent, options.githubApiUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.repos) {
|
if (options.repos) {
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ export interface InitializationOptions {
|
|||||||
* Desired log level
|
* Desired log level
|
||||||
*/
|
*/
|
||||||
logLevel?: LogLevel;
|
logLevel?: LogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a GitHub Enterprise Server should be used, the URL of the API endpoint, eg "https://ghe.my-company.com/api/v3"
|
||||||
|
*/
|
||||||
|
githubApiUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RepositoryContext {
|
export interface RepositoryContext {
|
||||||
|
|||||||
Reference in New Issue
Block a user