@sentry/junior-github 0.312.0 → 0.313.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/index.js CHANGED
@@ -4882,6 +4882,7 @@ async function loadPullRequestMergeState(env, pullRequest, requesterLogin) {
4882
4882
  headSha: pull.headRefOid,
4883
4883
  ...mergeableState ? { mergeableState } : void 0,
4884
4884
  requestedReviewers: pull.reviewRequests.nodes.flatMap((request) => request.requestedReviewer?.__typename === "User" && request.requestedReviewer.login ? [request.requestedReviewer.login] : []),
4885
+ reviewedBy: [],
4885
4886
  state: pull.state === "MERGED" ? "merged" : pull.state === "OPEN" ? "open" : "closed",
4886
4887
  title: pull.title,
4887
4888
  url: pull.url
@@ -4889,6 +4890,9 @@ async function loadPullRequestMergeState(env, pullRequest, requesterLogin) {
4889
4890
  if (!open) return state;
4890
4891
  const latest = /* @__PURE__ */ new Map();
4891
4892
  for (const review of reviews) if (review.author && review.state !== "COMMENTED" && review.state !== "PENDING") latest.set(review.author.login.toLowerCase(), review);
4893
+ const latestSubmitted = /* @__PURE__ */ new Map();
4894
+ for (const review of reviews) if (review.author && review.submittedAt && review.state !== "PENDING") latestSubmitted.set(review.author.login.toLowerCase(), review.state);
4895
+ state.reviewedBy = [...latestSubmitted].flatMap(([login, reviewState]) => reviewState === "DISMISSED" ? [] : [login]);
4892
4896
  const reviewStates = [...latest.values()].map((review) => review.state);
4893
4897
  if (!state.autoMerge && state.mergeableState === "clean") state.approved = reviewStates.includes("APPROVED") && !reviewStates.includes("CHANGES_REQUESTED");
4894
4898
  const login = requesterLogin?.toLowerCase();
@@ -5961,7 +5965,10 @@ async function requestGitHubReviewersWhenReady(args) {
5961
5965
  if (!opener?.conversationId) return;
5962
5966
  const named = await readGitHubDraftReviewers(args.state, target);
5963
5967
  const requester = named ? void 0 : await args.loadGitHubLogin?.(opener.identityId);
5964
- const reviewers = named ?? (requester ? [requester] : []);
5968
+ const candidates = named ?? (requester ? [requester] : []);
5969
+ if (candidates.length === 0) return;
5970
+ const { reviewedBy } = await loadPullRequestMergeState(args.env, target, void 0);
5971
+ const reviewers = candidates.filter((login) => !reviewedBy.includes(login.toLowerCase()));
5965
5972
  if (reviewers.length === 0) return;
5966
5973
  await requestPullRequestReviewers(args.env, {
5967
5974
  ...target,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.312.0",
3
+ "version": "0.313.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@0no-co/graphql.web": "^1.3.4",
32
- "@sentry/junior-plugin-api": "0.312.0",
32
+ "@sentry/junior-plugin-api": "0.313.0",
33
33
  "@sinclair/typebox": "^0.34.49",
34
34
  "drizzle-orm": "^0.45.4",
35
35
  "ignore": "^7.0.5",
@@ -37,7 +37,7 @@ Use `git` and `gh` for repository work.
37
37
  - When an error names a tool, use it. Change permissions only when GitHub rejected the request.
38
38
  - Stop for an unclear target, missing access, destructive work, or a GitHub permission failure.
39
39
  - Code changes always end in a pushed branch and a PR. Do not ask whether to open one. Skip it only when the user opts out or asks for investigation only.
40
- - Open the PR as a draft, unless the requester asks for a ready PR. A scope or follow-up question is not a reason to stop: open the PR, and name the question in the PR body and the report. Name each open decision of a draft in its PR body: when the required checks pass, the Watch marks a draft with no open decision ready for review. It checks the changed files against CODEOWNERS first: a draft that would ask code owners to review, or whose repo's `AGENTS.md` asks for drafts, stays a draft, and the Watch tells the requester that it waits for their review.
40
+ - Open the PR as a draft, unless the requester asks for a ready PR. A scope or follow-up question is not a reason to stop: open the PR, and name the question in the PR body and in one line of the reply. Name each open decision of a draft in its PR body: when the required checks pass, the Watch marks a draft with no open decision ready for review. It checks the changed files against CODEOWNERS first: a draft that would ask code owners to review, or whose repo's `AGENTS.md` asks for drafts, stays a draft, and the Watch tells the requester that it waits for their review.
41
41
  - Link the PR. Mention checks only when they failed or were skipped.
42
42
  - The runtime adds the requester `via` line. Do not write one.
43
43
  - Credit other people, such as a reporter, by GitHub `@login` so GitHub notifies them. Get the login from `userLookup` (`linked_identities` with provider `github`, else a GitHub link in `profile_fields`). Pass the Slack user ID when known. With no login, write the name. Never guess a login. When you delegate the write, put the `@login` in the brief.