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
76 ],76 ],
77 })77 })
78 .pipe(78 .pipe(
79 Effect.flatMap((result) =>79 Effect.flatMap((result) => {
80 Effect.sync(() => decodeGitHubPullRequestListJson(result.stdout.trim())).pipe(80 const raw = result.stdout.trim();
81 if (raw.length === 0) {
82 return Effect.succeed([]);
83 }
84 return Effect.sync(() => decodeGitHubPullRequestListJson(raw)).pipe(
81 Effect.flatMap((decoded) =>85 Effect.flatMap((decoded) =>
82 Result.isSuccess(decoded)86 Result.isSuccess(decoded)
83 ? Effect.succeed(87 ? Effect.succeed(
@@ -95,8 +99,8 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 11 unmodified lines
95 }),99 }),
96 ),100 ),
97 ),101 ),
98 ),102 );
99 ),103 }),
100 Effect.mapError((error) =>104 Effect.mapError((error) =>
101 Schema.is(SourceControlProviderError)(error)105 Schema.is(SourceControlProviderError)(error)
102 ? error106 ? 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