MCPcopy Index your code
hub / github.com/wei/pull / getLivePullConfig

Function getLivePullConfig

src/utils/get-pull-config.ts:7–36  ·  view source on GitHub ↗
(
  octokit: ProbotOctokit,
  log: Logger,
  jobData: SchedulerJobData,
)

Source from the content-addressed store, hash-verified

5import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods";
6
7async function getLivePullConfig(
8 octokit: ProbotOctokit,
9 log: Logger,
10 jobData: SchedulerJobData,
11): Promise<PullConfig | null> {
12 log.debug(`⚙️ Fetching live config`);
13
14 const { owner, repo } = jobData;
15
16 const { config } = await octokit.config.get({
17 owner,
18 repo,
19 path: `.github/${appConfig.configFilename}`,
20 });
21
22 // Log config if found
23 if (!config || !config.version) {
24 log.warn("⚠️ No config found");
25 return null;
26 } else {
27 log.info({ config }, "⚙️ Config found");
28 }
29
30 const result = pullConfigSchema.safeParse(config);
31 if (!result.success) {
32 throw new Error("Invalid config");
33 }
34
35 return result.data;
36}
37
38function getDefaultPullConfig(
39 repository: RestEndpointMethodTypes["repos"]["get"]["response"]["data"],

Callers 1

getPullConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected