Skip to content

Commit 1cbcaea

Browse files
committed
fix: clarify check setup requirements
Return an actionable 404 when /check cannot find the scheduler repository record, and document that the app must be installed before configuration validation. Fixes #658
1 parent 197574c commit 1cbcaea

4 files changed

Lines changed: 30 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ to yours using **hard reset** periodically. You can also manually
115115
conflictLabel: "merge-conflict" # Optional, on merge conflict assign a custom label, Default: merge-conflict
116116
```
117117
118-
4. Go to `https://pull.git.ci/check/${owner}/${repo}` to validate your
119-
`.github/pull.yml`.
120-
5. Install
118+
4. Install
121119
**[<img src="https://prod.download/pull-18h-svg" valign="bottom"/> Pull app][pull-app]**.
120+
5. Go to `https://pull.git.ci/check/${owner}/${repo}` to validate your
121+
`.github/pull.yml`.
122122

123123
### Trigger Manually
124124

‎src/router/repo-handler.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Request, Response } from "express";
22
import type { Probot } from "probot";
33
import { appConfig } from "@/src/configs/app-config.ts";
44
import { getPullConfig } from "@/src/utils/get-pull-config.ts";
5+
import { missingRepositoryResponse } from "@/src/router/repo-response.ts";
56
import {
67
createSchedulerService,
78
JobPriority,
@@ -21,8 +22,9 @@ function getRepoHandlers(
2122
const repoRecord = await RepositoryModel.findOne({ full_name });
2223

2324
if (!repoRecord) {
24-
app.log.error({ full_name }, `❌ Repo record not found`);
25-
throw new Error(`❌ Repo record not found`);
25+
app.log.warn({ full_name }, "Repository is not registered");
26+
const response = missingRepositoryResponse(full_name);
27+
return res.status(response.statusCode).json(response.body);
2628
}
2729

2830
const {

‎src/router/repo-response.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { assertEquals } from "@std/assert";
2+
import { missingRepositoryResponse } from "@/src/router/repo-response.ts";
3+
4+
Deno.test("missing repository response explains installation requirement", () => {
5+
assertEquals(missingRepositoryResponse("dockur/zima"), {
6+
statusCode: 404,
7+
body: {
8+
status: "error",
9+
message:
10+
"Repository 'dockur/zima' is not registered. Install the Pull GitHub App on this repository before checking its configuration.",
11+
},
12+
});
13+
});

‎src/router/repo-response.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export function missingRepositoryResponse(fullName: string) {
2+
return {
3+
statusCode: 404,
4+
body: {
5+
status: "error",
6+
message:
7+
`Repository '${fullName}' is not registered. Install the Pull GitHub App on this repository before checking its configuration.`,
8+
},
9+
} as const;
10+
}

0 commit comments

Comments
 (0)