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

Function main

scripts/manual-process.ts:8–62  ·  view source on GitHub ↗
(full_name: string)

Source from the content-addressed store, hash-verified

6import { Pull } from "@/src/processor/pull.ts";
7
8async function main(full_name: string) {
9 let exitCode = 0;
10
11 try {
12 await connectMongoDB();
13
14 logger.info(`🏃 Processing repo job ${full_name}`);
15
16 try {
17 // Get Octokit
18 const probot = createProbot({ overrides: { log: logger } });
19
20 const repoRecord = await RepositoryModel.findOne({ full_name });
21
22 if (!repoRecord) {
23 logger.error({ full_name }, `❌ Repo record not found`);
24 throw new Error(`❌ Repo record not found`);
25 }
26
27 const { installation_id, owner: { login: owner }, name: repo } =
28 repoRecord;
29
30 const octokit = await probot.auth(installation_id);
31
32 const config = await getPullConfig(octokit, logger, {
33 installation_id,
34 owner,
35 repo,
36 repository_id: 0,
37 metadata: {
38 cron: "",
39 job_priority: JobPriority.Normal,
40 repository_id: 0,
41 },
42 });
43 if (!config) {
44 logger.info(`⚠️ No config found, skipping`);
45 return;
46 }
47
48 const pull = new Pull(octokit, { owner, repo, logger }, config);
49 await pull.routineCheck();
50
51 logger.info(`✅ Repo job processed successfully`);
52 } catch (error) {
53 logger.error(error, "❌ Repo job failed");
54 }
55 } catch (error) {
56 logger.error(error, "Error processing");
57 exitCode = 1;
58 } finally {
59 await disconnectMongoDB();
60 Deno.exit(exitCode);
61 }
62}
63
64if (import.meta.main) {
65 const args = Deno.args;

Callers 1

manual-process.tsFile · 0.70

Calls 4

routineCheckMethod · 0.95
connectMongoDBFunction · 0.90
getPullConfigFunction · 0.90
disconnectMongoDBFunction · 0.90

Tested by

no test coverage detected