History

Handle empty GitHub PR listings and fallback branch lookup

- Treat empty `gh pr list` output as no results - Fall back to `main` when provider default-branch detection fails - Add coverage for PR creation fallback behavior

Julius Marminge committed 6 months ago

Commit a73408c1 parent 1e0a7594 files · +72 −7Browse files

Showing the changes to apps/server/src/sourceControl/GitHubSourceControlProvider.ts (1 of 4 files). Show all

Unified · Split

apps/server/src/sourceControl/GitHubSourceControlProvider.ts+8−4
@@ -76,8 +76,12 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 75 unmodified lines
7676 ],
7777 })
7878 .pipe(
79− Effect.flatMap((result) =>
80− Effect.sync(() => decodeGitHubPullRequestListJson(result.stdout.trim())).pipe(
79+ Effect.flatMap((result) => {
80+ const raw = result.stdout.trim();
81+ if (raw.length === 0) {
82+ return Effect.succeed([]);
83+ }
84+ return Effect.sync(() => decodeGitHubPullRequestListJson(raw)).pipe(
8185 Effect.flatMap((decoded) =>
8286 Result.isSuccess(decoded)
8387 ? Effect.succeed(
@@ -95,8 +99,8 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 11 unmodified lines
9599 }),
96100 ),
97101 ),
98− ),
99− ),
102+ );
103+ }),
100104 Effect.mapError((error) =>
101105 Schema.is(SourceControlProviderError)(error)
102106 ? error

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t