@sentry/junior-github 0.294.0 → 0.296.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-J4ZSG7SD.js → chunk-D74ZUIJR.js} +14 -5
- package/dist/credential-support.d.ts +2 -1
- package/dist/default-branch.d.ts +15 -0
- package/dist/egress-policy.d.ts +7 -2
- package/dist/index.js +663 -287
- package/dist/receive-pack-policy.d.ts +21 -0
- package/dist/testing.js +1 -1
- package/dist/tools/stack-pull-request.d.ts +1 -0
- package/dist/tools/update-pull-request-feedback.d.ts +15 -5
- package/dist/webhooks/handler.d.ts +2 -0
- package/dist/webhooks/installation-requests.d.ts +3 -2
- package/dist/webhooks/pull-request-ready.d.ts +3 -2
- package/dist/webhooks/pull-request-review-request.d.ts +32 -0
- package/package.json +4 -2
- package/skills/github-code/references/api-surface.md +1 -1
- package/skills/github-code/references/troubleshooting-workarounds.md +1 -0
|
@@ -231,13 +231,16 @@ var GITHUB_PULL_REQUEST_EVENTS = [
|
|
|
231
231
|
];
|
|
232
232
|
var STACK_CHECK = "Check if the pull request is in a stack: `gh api 'repos/OWNER/REPO/stacks?pull_request=NUMBER'`.";
|
|
233
233
|
var STACK_CONFLICT_STEPS = "run `gh stack rebase`, resolve each conflict so that both changes stay intact, stage the files, and run `gh stack rebase --continue`. Run the checks again, run `gh stack push`, and confirm that each open pull request in the stack can merge. Report the files that had conflicts.";
|
|
234
|
+
var PULL_REQUEST_FEEDBACK = 'When Verified details include comment_id, call github_updatePullRequestFeedback after acting on actionable feedback, with the exact repo, pull_request, comment_id, and comment_kind from Verified details, and status "addressed" or "declined".';
|
|
234
235
|
var GITHUB_PULL_REQUEST_EVENT_GUIDANCE = {
|
|
235
236
|
"pull_request.checks.failed": "Fix only failures that the pull request causes. Do not skip, disable, or weaken a check to make it pass.",
|
|
236
237
|
// An approval with a body also arrives as review.commented in the same
|
|
237
238
|
// Turn, so this guidance must not tell the agent to hold off on that body.
|
|
238
|
-
"pull_request.review.approved":
|
|
239
|
-
"pull_request.
|
|
240
|
-
"pull_request.
|
|
239
|
+
"pull_request.review.approved": `When the approval includes actionable feedback, address it like any other review feedback. ${PULL_REQUEST_FEEDBACK}`,
|
|
240
|
+
"pull_request.review.changes_requested": PULL_REQUEST_FEEDBACK,
|
|
241
|
+
"pull_request.review.commented": PULL_REQUEST_FEEDBACK,
|
|
242
|
+
"pull_request.comment.created": PULL_REQUEST_FEEDBACK,
|
|
243
|
+
"pull_request.review_comment.created": `${PULL_REQUEST_FEEDBACK} Then resolve the thread with github_resolvePullRequestReviewThread.`,
|
|
241
244
|
"pull_request.merge_conflict": `${STACK_CHECK} If it is, run \`gh stack checkout NUMBER\`, then ${STACK_CONFLICT_STEPS} If it is not, fetch base_branch from Verified details and merge it into the pull request branch. Do not rebase. Resolve each conflict so that both the pull request change and the base branch change stay intact. Run the checks again, push, and confirm that the pull request can merge. Report the files that had conflicts.`
|
|
242
245
|
};
|
|
243
246
|
function gitHubPullRequestEventGuidance(guidance) {
|
|
@@ -1963,7 +1966,7 @@ var pullRequestEventDataSchema = commentAuthorDataSchema.extend({
|
|
|
1963
1966
|
openerEmail: z6.string().min(1).optional(),
|
|
1964
1967
|
openerUsername: z6.string().min(1).optional(),
|
|
1965
1968
|
commentId: z6.number().optional(),
|
|
1966
|
-
commentKind: z6.enum(["conversation", "review"]).optional()
|
|
1969
|
+
commentKind: z6.enum(["conversation", "review", "review_body"]).optional()
|
|
1967
1970
|
}).strict();
|
|
1968
1971
|
function pullRequestEventData(input) {
|
|
1969
1972
|
const { pullRequest } = input;
|
|
@@ -2141,6 +2144,9 @@ var pullRequestReviewWebhookSchema = z6.object({
|
|
|
2141
2144
|
repository: repositorySchema2,
|
|
2142
2145
|
review: z6.object({
|
|
2143
2146
|
body: z6.string().optional().nullable(),
|
|
2147
|
+
// Only the feedback reaction needs the id, so a review without one is
|
|
2148
|
+
// still delivered.
|
|
2149
|
+
id: z6.number().optional(),
|
|
2144
2150
|
state: z6.string(),
|
|
2145
2151
|
user: z6.object({ login: z6.string().optional() }).optional()
|
|
2146
2152
|
}),
|
|
@@ -2168,7 +2174,10 @@ function normalizePullRequestReviewEvent(deliveryId, body, botEmail) {
|
|
|
2168
2174
|
trustedSummary: eventType === "pull_request.review.approved" ? `${resource.label} was approved${reviewer ? ` by ${reviewer}` : ""}.` : eventType === "pull_request.review.changes_requested" ? `${resource.label} received requested changes${reviewer ? ` from ${reviewer}` : ""}.` : `${resource.label} received a review comment${reviewer ? ` from ${reviewer}` : ""}.`,
|
|
2169
2175
|
...gitHubDoneBy(reviewer),
|
|
2170
2176
|
data: pullRequestEventData({
|
|
2171
|
-
comment:
|
|
2177
|
+
comment: {
|
|
2178
|
+
...review.id !== void 0 && nonBlank(review.body) ? { commentId: review.id, commentKind: "review_body" } : void 0,
|
|
2179
|
+
...commentAuthorData({ botEmail, sender, text: review.body })
|
|
2180
|
+
},
|
|
2172
2181
|
pullRequest,
|
|
2173
2182
|
repo
|
|
2174
2183
|
}),
|
|
@@ -35,7 +35,8 @@ type LoadInstallationReadPermissions = (input: {
|
|
|
35
35
|
appJwt: string;
|
|
36
36
|
installationId: number;
|
|
37
37
|
}) => Promise<Record<string, "read">>;
|
|
38
|
-
|
|
38
|
+
/** A GitHub repository named by owner and name. */
|
|
39
|
+
export interface GitHubRepository {
|
|
39
40
|
name: string;
|
|
40
41
|
owner: string;
|
|
41
42
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default branch lookup for the Git push policy.
|
|
3
|
+
*
|
|
4
|
+
* The egress grant hook decides whether a push may leave the sandbox, so it
|
|
5
|
+
* cannot read GitHub through host egress. This file calls GitHub directly,
|
|
6
|
+
* with a metadata-only installation token.
|
|
7
|
+
*/
|
|
8
|
+
import type { PluginCache } from "@sentry/junior-plugin-api";
|
|
9
|
+
import { type GitHubRepository } from "./credential-support.js";
|
|
10
|
+
import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
|
|
11
|
+
/**
|
|
12
|
+
* Read a repository's default branch with a metadata-only installation
|
|
13
|
+
* token. Results are cached for ten minutes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadDefaultBranch(env: GitHubInstallationEnv, cache: PluginCache, repository: GitHubRepository): Promise<string>;
|
package/dist/egress-policy.d.ts
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* each request needs. Junior-owned issue, pull request, review, and push
|
|
6
6
|
* writes never fall back to user OAuth. Merge, fork, branch deletion, REST ref
|
|
7
7
|
* writes, and administration stay unsupported; unknown REST writes and
|
|
8
|
-
* GraphQL mutations are denied.
|
|
8
|
+
* GraphQL mutations are denied. Git pushes never touch the default branch.
|
|
9
9
|
*/
|
|
10
10
|
import { type EgressHookContext, type EgressResponseHookContext } from "@sentry/junior-plugin-api";
|
|
11
|
+
import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
|
|
11
12
|
import { type GitHubGrant } from "./credential-support.js";
|
|
12
13
|
/**
|
|
13
14
|
* Classify a GitHub response as a permission denial.
|
|
@@ -17,4 +18,8 @@ import { type GitHubGrant } from "./credential-support.js";
|
|
|
17
18
|
* permission problems.
|
|
18
19
|
*/
|
|
19
20
|
export declare function githubPermissionDeniedMessage(ctx: EgressResponseHookContext): Promise<string | undefined>;
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Select the GitHub grant for one egress request, and name its repository
|
|
23
|
+
* for the write audit event.
|
|
24
|
+
*/
|
|
25
|
+
export declare function githubGrantForEgress(ctx: EgressHookContext, env: GitHubInstallationEnv): Promise<GitHubGrant>;
|