fix: reduce GitHub quota use with sharing enabled (#11888)

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Bilal BakrandJulius Marminge authored and GitHub committed 2026-09-15 15:30:58 -07:00
1 parent b84f63bb13
commit f4600d77dd
20 files changed
+1020 -273

No files matched your search

@@ -127,6 +127,9 @@ export const make = Effect.gen(function* () {
.listOpenPullRequests({
cwd: input.cwd,
headSelector: input.headSelector,
...(input.context === undefined
? {}
: { rateLimitHost: new URL(input.context.provider.baseUrl).host }),
...(input.limit !== undefined ? { limit: input.limit } : {}),
})
.pipe(
@@ -152,6 +155,9 @@ export const make = Effect.gen(function* () {
return github
.execute({
cwd: input.cwd,
...(input.context === undefined
? {}
: { rateLimitHost: new URL(input.context.provider.baseUrl).host }),
args: [
"pr",
"list",
@@ -267,23 +273,30 @@ export const make = Effect.gen(function* () {
},
listChangeRequests,
getChangeRequest: (input) =>
github.getPullRequest(input).pipe(
Effect.map(toChangeRequest),
Effect.mapError(
(error) =>
new SourceControlProviderError({
provider: "github",
operation: "getChangeRequest",
command: error.command,
cwd: input.cwd,
reference: SourceControlProvider.transportSafeSourceControlErrorValue(
input.reference,
),
detail: error.detail,
cause: error,
}),
github
.getPullRequest({
...input,
...(input.context === undefined
? {}
: { rateLimitHost: new URL(input.context.provider.baseUrl).host }),
})
.pipe(
Effect.map(toChangeRequest),
Effect.mapError(
(error) =>
new SourceControlProviderError({
provider: "github",
operation: "getChangeRequest",
command: error.command,
cwd: input.cwd,
reference: SourceControlProvider.transportSafeSourceControlErrorValue(
input.reference,
),
detail: error.detail,
cause: error,
}),
),
),
),
createChangeRequest: (input) =>
github
.createPullRequest({
@@ -344,19 +357,26 @@ export const make = Effect.gen(function* () {
),
),
getDefaultBranch: (input) =>
github.getDefaultBranch(input).pipe(
Effect.mapError(
(error) =>
new SourceControlProviderError({
provider: "github",
operation: "getDefaultBranch",
command: error.command,
cwd: input.cwd,
detail: error.detail,
cause: error,
}),
github
.getDefaultBranch({
...input,
...(input.context === undefined
? {}
: { rateLimitHost: new URL(input.context.provider.baseUrl).host }),
})
.pipe(
Effect.mapError(
(error) =>
new SourceControlProviderError({
provider: "github",
operation: "getDefaultBranch",
command: error.command,
cwd: input.cwd,
detail: error.detail,
cause: error,
}),
),
),
),
checkoutChangeRequest: (input) =>
github.checkoutPullRequest(input).pipe(
Effect.mapError(