fix: address review findings (#2206)
This commit is contained in:
@@ -62,6 +62,11 @@ const PullRequestChecks = PullRequest.extend({
|
||||
headSha: OptionalString
|
||||
})
|
||||
|
||||
const RerunPullRequestChecks = PullRequest.extend({
|
||||
headSha: OptionalString,
|
||||
failedOnly: z.boolean().optional()
|
||||
})
|
||||
|
||||
const PullRequestFileContents = RepoSelector.extend({
|
||||
prNumber: z.number().int().positive(),
|
||||
path: requiredString('Missing file path'),
|
||||
@@ -92,6 +97,18 @@ const MergePr = RepoSelector.extend({
|
||||
method: z.enum(['merge', 'squash', 'rebase']).optional()
|
||||
})
|
||||
|
||||
const UpdatePrState = RepoSelector.extend({
|
||||
prNumber: z.number().int().positive(),
|
||||
updates: z.object({
|
||||
state: z.enum(['open', 'closed'])
|
||||
})
|
||||
})
|
||||
|
||||
const RequestPrReviewers = RepoSelector.extend({
|
||||
prNumber: z.number().int().positive(),
|
||||
reviewers: z.array(z.string()).min(1)
|
||||
})
|
||||
|
||||
const CreateIssue = RepoSelector.extend({
|
||||
title: requiredString('Missing title'),
|
||||
body: z.string()
|
||||
@@ -188,6 +205,7 @@ const SlugPullRequestUpdate = z.object({
|
||||
repo: requiredString('Missing repo'),
|
||||
number: z.number().int().positive(),
|
||||
updates: z.object({
|
||||
state: z.enum(['open', 'closed']).optional(),
|
||||
title: OptionalString,
|
||||
body: OptionalString
|
||||
})
|
||||
@@ -294,6 +312,15 @@ export const GITHUB_METHODS: RpcMethod[] = [
|
||||
noCache: params.noCache
|
||||
})
|
||||
}),
|
||||
defineMethod({
|
||||
name: 'github.rerunPRChecks',
|
||||
params: RerunPullRequestChecks,
|
||||
handler: async (params, { runtime }) =>
|
||||
runtime.rerunRepoPRChecks(params.repo, params.prNumber, {
|
||||
headSha: params.headSha,
|
||||
failedOnly: params.failedOnly
|
||||
})
|
||||
}),
|
||||
defineMethod({
|
||||
name: 'github.prComments',
|
||||
params: PullRequest,
|
||||
@@ -341,6 +368,18 @@ export const GITHUB_METHODS: RpcMethod[] = [
|
||||
handler: async (params, { runtime }) =>
|
||||
runtime.mergeRepoPR(params.repo, params.prNumber, params.method)
|
||||
}),
|
||||
defineMethod({
|
||||
name: 'github.updatePRState',
|
||||
params: UpdatePrState,
|
||||
handler: async (params, { runtime }) =>
|
||||
runtime.updateRepoPRState(params.repo, params.prNumber, params.updates)
|
||||
}),
|
||||
defineMethod({
|
||||
name: 'github.requestPRReviewers',
|
||||
params: RequestPrReviewers,
|
||||
handler: async (params, { runtime }) =>
|
||||
runtime.requestRepoPRReviewers(params.repo, params.prNumber, params.reviewers)
|
||||
}),
|
||||
defineMethod({
|
||||
name: 'github.createIssue',
|
||||
params: CreateIssue,
|
||||
|
||||
Reference in New Issue
Block a user