Files
claude-code-action/src/github/api/client.ts
2025-06-01 21:07:44 -07:00

24 lines
497 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,
baseUrl: GITHUB_API_URL,
}),
graphql: graphql.defaults({
baseUrl: GITHUB_API_URL,
headers: {
authorization: `token ${token}`,
},
}),
};
}