@sentry/junior-github 0.294.0 → 0.295.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 +635 -193
- package/dist/receive-pack-policy.d.ts +21 -0
- package/dist/testing.js +1 -1
- 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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git push policy for GitHub smart HTTP.
|
|
3
|
+
*
|
|
4
|
+
* Junior pushes with the App installation token, so a push lands as the App
|
|
5
|
+
* no matter who asked. Junior proposes changes through pull requests. It
|
|
6
|
+
* never updates or deletes the repository's default branch, and it pushes
|
|
7
|
+
* only branches. Other protected branches rely on GitHub rulesets.
|
|
8
|
+
*/
|
|
9
|
+
import { type PluginAuditAttributes, type PluginCache, type PluginGitPush } from "@sentry/junior-plugin-api";
|
|
10
|
+
import type { GitHubRepository } from "./credential-support.js";
|
|
11
|
+
import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
|
|
12
|
+
/**
|
|
13
|
+
* Refuse a Git push that changes the default branch or a ref outside
|
|
14
|
+
* `refs/heads/`. Returns the audit attributes for an allowed push.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertGitHubPushAllowed(input: {
|
|
17
|
+
cache: PluginCache;
|
|
18
|
+
env: GitHubInstallationEnv;
|
|
19
|
+
gitPush: PluginGitPush | undefined;
|
|
20
|
+
repository: GitHubRepository;
|
|
21
|
+
}): Promise<PluginAuditAttributes>;
|
package/dist/testing.js
CHANGED
|
@@ -21,16 +21,28 @@ interface PullRequestCommentRef {
|
|
|
21
21
|
export declare function pullRequestCommentReactionsPath(input: PullRequestCommentRef): string;
|
|
22
22
|
/** Return the GitHub reaction for one feedback state. */
|
|
23
23
|
export declare function pullRequestFeedbackReactionContent(status: FeedbackStatus): (typeof STATUS_TO_REACTION_CONTENT)[FeedbackStatus];
|
|
24
|
+
/** Build the GitHub API path for one pull request review. */
|
|
25
|
+
export declare function pullRequestReviewPath(input: {
|
|
26
|
+
owner: string;
|
|
27
|
+
name: string;
|
|
28
|
+
pullRequest: number;
|
|
29
|
+
reviewId: number;
|
|
30
|
+
}): string;
|
|
31
|
+
/** Return the GraphQL name of one REST reaction content. */
|
|
32
|
+
export declare function graphqlReactionContent(content: string): string;
|
|
33
|
+
/** The GraphQL mutation that adds one reaction to a review body. */
|
|
34
|
+
export declare const ADD_REVIEW_REACTION_MUTATION = "mutation AddReviewReaction($subjectId: ID!, $content: ReactionContent!) {\n addReaction(input: {subjectId: $subjectId, content: $content}) {\n reaction { content }\n }\n}";
|
|
24
35
|
/**
|
|
25
|
-
* Set Junior's feedback reaction on a pull request comment
|
|
26
|
-
* state reactions Junior previously added to the same comment.
|
|
36
|
+
* Set Junior's feedback reaction on a pull request comment or review body.
|
|
37
|
+
* Replace only state reactions Junior previously added to the same comment.
|
|
27
38
|
*/
|
|
28
39
|
export declare function createGitHubUpdatePullRequestFeedbackTool(ctx: {
|
|
29
40
|
egress: PluginEgress;
|
|
30
41
|
}, botEmail: string | undefined): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
31
42
|
repo: string;
|
|
32
|
-
comment_kind: "conversation" | "review";
|
|
43
|
+
comment_kind: "conversation" | "review" | "review_body";
|
|
33
44
|
comment_id: number;
|
|
45
|
+
pull_request: number;
|
|
34
46
|
status: "addressed" | "declined";
|
|
35
47
|
}, {
|
|
36
48
|
[x: string]: unknown;
|
|
@@ -96,7 +108,6 @@ export declare function createGitHubUpdatePullRequestFeedbackTool(ctx: {
|
|
|
96
108
|
repo: string;
|
|
97
109
|
comment_id: number;
|
|
98
110
|
status: "addressed" | "declined";
|
|
99
|
-
reaction_id: number;
|
|
100
111
|
}, {
|
|
101
112
|
[x: string]: unknown;
|
|
102
113
|
objectAnnotations?: {
|
|
@@ -161,6 +172,5 @@ export declare function createGitHubUpdatePullRequestFeedbackTool(ctx: {
|
|
|
161
172
|
repo: string;
|
|
162
173
|
comment_id: number;
|
|
163
174
|
status: "addressed" | "declined";
|
|
164
|
-
reaction_id: number;
|
|
165
175
|
}>;
|
|
166
176
|
export {};
|
|
@@ -12,7 +12,9 @@ declare const feedbackTargetSchema: z.ZodObject<{
|
|
|
12
12
|
commentKind: z.ZodEnum<{
|
|
13
13
|
conversation: "conversation";
|
|
14
14
|
review: "review";
|
|
15
|
+
review_body: "review_body";
|
|
15
16
|
}>;
|
|
17
|
+
pullRequest: z.ZodNumber;
|
|
16
18
|
repo: z.ZodString;
|
|
17
19
|
}, z.core.$strip>;
|
|
18
20
|
type FeedbackTarget = z.output<typeof feedbackTargetSchema>;
|
|
@@ -30,10 +30,11 @@ export declare function searchOpenPullRequestMergeability(env: GitHubInstallatio
|
|
|
30
30
|
author: string;
|
|
31
31
|
repositoryFullName: string;
|
|
32
32
|
}): Promise<unknown>;
|
|
33
|
-
/** Add the "reviewing" reaction to one pull request
|
|
33
|
+
/** Add the "reviewing" reaction to one pull request comment or review body. */
|
|
34
34
|
export declare function markPullRequestFeedbackReviewing(env: GitHubInstallationEnv, target: {
|
|
35
35
|
commentId: number;
|
|
36
|
-
commentKind: "conversation" | "review";
|
|
36
|
+
commentKind: "conversation" | "review" | "review_body";
|
|
37
|
+
pullRequest: number;
|
|
37
38
|
repo: string;
|
|
38
39
|
}): Promise<void>;
|
|
39
40
|
/**
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* so no person needs the notice. Each webhook that can change one of
|
|
7
7
|
* these facts reads them again from GitHub. The notice goes to the
|
|
8
8
|
* Conversation where a person asked Junior to open the pull request. It is
|
|
9
|
-
* assigned to that person only when they are in that Conversation
|
|
10
|
-
*
|
|
9
|
+
* assigned to that person only when they are in that Conversation, and it
|
|
10
|
+
* waits on them: the merge is their step. It closes when the pull request
|
|
11
|
+
* merges, closes, or is no longer ready.
|
|
11
12
|
*/
|
|
12
13
|
import type { PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
|
|
13
14
|
import type { GitHubDb } from "../db/database.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "review requested" ask on the review desk for a Junior pull request.
|
|
3
|
+
*
|
|
4
|
+
* When GitHub asks the requester for a review on a pull request that they
|
|
5
|
+
* asked Junior to open, the ask goes to the Conversation where they asked.
|
|
6
|
+
* It is assigned to them only when they are in that Conversation, and it
|
|
7
|
+
* waits on them. It closes when they submit a review, when the request is
|
|
8
|
+
* removed, or when the pull request closes. Reopening the pull request adds
|
|
9
|
+
* it again while their request is still open, because GitHub does not send
|
|
10
|
+
* a new request for it. GitHub sends each of these facts in the webhook, so
|
|
11
|
+
* the ask needs no GitHub read and no saved state.
|
|
12
|
+
*
|
|
13
|
+
* Only the requester can get the ask. Junior maps a GitHub login to a person
|
|
14
|
+
* only through the requester's linked GitHub account, and other pull
|
|
15
|
+
* requests have no Conversation for the ask.
|
|
16
|
+
*/
|
|
17
|
+
import type { PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
|
|
18
|
+
import type { GitHubDb } from "../db/database.js";
|
|
19
|
+
/**
|
|
20
|
+
* Add or close the "review requested" ask of a Junior pull request when one
|
|
21
|
+
* webhook delivery changes the review request of its requester. The ask is
|
|
22
|
+
* optional, so a failure is logged and does not fail the delivery.
|
|
23
|
+
*/
|
|
24
|
+
export declare function syncGitHubPullRequestReviewRequest(args: {
|
|
25
|
+
body: unknown;
|
|
26
|
+
db: GitHubDb;
|
|
27
|
+
deliveryId: string;
|
|
28
|
+
eventName: string;
|
|
29
|
+
loadGitHubLogin?(identityId: string): Promise<string | undefined>;
|
|
30
|
+
log?: Pick<PluginLogger, "error">;
|
|
31
|
+
reviewItems: PluginConversationReviewItems;
|
|
32
|
+
}): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.295.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,14 +32,16 @@
|
|
|
32
32
|
"drizzle-orm": "^0.45.2",
|
|
33
33
|
"marked": "^18.1.2",
|
|
34
34
|
"zod": "^4.5.4",
|
|
35
|
-
"@sentry/junior-plugin-api": "0.
|
|
35
|
+
"@sentry/junior-plugin-api": "0.295.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@oxlint/plugins": "1.79.0",
|
|
39
39
|
"@types/node": "^25.9.1",
|
|
40
|
+
"@types/pg": "^8.15.6",
|
|
40
41
|
"drizzle-kit": "^0.31.8",
|
|
41
42
|
"msw": "^2.14.6",
|
|
42
43
|
"oxlint": "^1.79.0",
|
|
44
|
+
"pg": "^8.16.3",
|
|
43
45
|
"tsup": "^8.5.1",
|
|
44
46
|
"typescript": "^7.0.2",
|
|
45
47
|
"vitest": "^4.1.12",
|
|
@@ -13,7 +13,7 @@ If the user omits `owner/repo`, run `jr-rpc config get github.repo`. Then pass `
|
|
|
13
13
|
| `github.actions.read` | `gh run list`, `gh run view`, `gh run watch`, `gh workflow list`, `gh workflow view` |
|
|
14
14
|
| `github.actions.write` | `gh workflow run`, `gh run rerun`, `gh run cancel` |
|
|
15
15
|
| `github.contents.read` | `github_cloneRepository`, `git fetch` |
|
|
16
|
-
| `github.contents.write` | Git smart-HTTP `git push` only
|
|
16
|
+
| `github.contents.write` | Git smart-HTTP `git push` to branches other than the default branch only |
|
|
17
17
|
| `github.workflows.write` | Workflow-file changes on push |
|
|
18
18
|
| `github.pull-requests.read` | `gh pr view`, `gh pr list`, `gh pr diff`, `gh pr checks` |
|
|
19
19
|
| `github.pull-requests.write` | GitHub tools and supported REST writes |
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
| `junior-auth-required` with `user-write` | Follow the private OAuth prompt. Never ask for a pasted token. |
|
|
9
9
|
| `git push` returns 401 or 403 | Check the remote and repository. Retry once, then report the installation access failure. |
|
|
10
10
|
| `permission_denied` has `source: "upstream"` | Read GitHub's error. Report an access problem only if it says access denied or SSO. |
|
|
11
|
+
| `permission_denied` has `source: "policy"` | The runtime refused it. Follow its message. Push a new branch and open a PR. |
|
|
11
12
|
| Other 403 response | Read the error and use the tool it names. |
|
|
12
13
|
| `gh auth status` shows no token scopes | This is normal for GitHub App user tokens. Check App permissions instead. |
|
|
13
14
|
| `github_createPullRequest` returns 401 or 403 | Report the installation access failure. Do not use user OAuth. |
|