mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 06:54:13 +08:00
21 lines
455 B
TypeScript
21 lines
455 B
TypeScript
import { Octokit } from "@octokit/rest";
|
|
import { graphql } from "@octokit/graphql";
|
|
import { GITHUB_API_URL } from "./config";
|
|
|
|
export type Octokits = {
|
|
rest: Octokit;
|
|
graphql: typeof graphql;
|
|
};
|
|
|
|
export function createOctokit(token: string): Octokits {
|
|
return {
|
|
rest: new Octokit({ auth: token }),
|
|
graphql: graphql.defaults({
|
|
baseUrl: GITHUB_API_URL,
|
|
headers: {
|
|
authorization: `token ${token}`,
|
|
},
|
|
}),
|
|
};
|
|
}
|