Extract client creation

Also default to use the language server version in the user agent
This commit is contained in:
Christopher Schleiden
2023-01-30 17:05:32 -08:00
parent 623b6d83e4
commit b5c5720b48
8 changed files with 52 additions and 46 deletions
+9
View File
@@ -0,0 +1,9 @@
import {Octokit} from "@octokit/rest";
import {version} from "../package.json";
export function getClient(token: string, userAgent?: string): Octokit {
return new Octokit({
auth: token,
userAgent: userAgent || `GitHub Actions Language Server (${version})`
});
}