Skip to content

Commit 1a52d4e

Browse files
committed
docs: describe the reminder type properties on the type itself
1 parent 936323e commit 1a52d4e

3 files changed

Lines changed: 39 additions & 45 deletions

File tree

‎.github/scripts/dependabot-pr-reminder/github-api.mts‎

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,34 @@ import type { Octokit } from 'octokit';
22

33
import type { PullRequest } from './types.mts';
44

5-
/** The part of the GraphQL search response the reminder reads. */
5+
/**
6+
* The part of the GraphQL search response the reminder reads.
7+
*
8+
* @property search - The search result.
9+
* @property search.pageInfo - Tells whether another page follows and where it starts.
10+
* @property search.pageInfo.hasNextPage - Whether more results remain after this page.
11+
* @property search.pageInfo.endCursor - The cursor to pass to get the next page.
12+
* @property search.nodes - The matching pull requests.
13+
* @property search.nodes.number - The pull request number.
14+
* @property search.nodes.title - The pull request title.
15+
* @property search.nodes.url - The link to the pull request.
16+
* @property search.nodes.reviewRequests - The reviewers still requested.
17+
* @property search.nodes.commits - The latest commit, which holds the checks state.
18+
*/
619
type SearchResult = {
720
search: {
8-
/** Tells whether another page follows and where it starts. */
9-
pageInfo: {
10-
/** Whether more results remain after this page. */
11-
hasNextPage: boolean;
12-
/** The cursor to pass to get the next page. */
13-
endCursor: string | null;
14-
};
15-
/** The matching pull requests. */
21+
pageInfo: { hasNextPage: boolean; endCursor: string | null };
1622
nodes: {
17-
/** The pull request number. */
1823
number: number;
19-
/** The pull request title. */
2024
title: string;
21-
/** The link to the pull request. */
2225
url: string;
23-
/** The reviewers still requested. */
2426
reviewRequests: {
2527
nodes: {
26-
/** The requested user or team, `null` when it can't be read. */
27-
requestedReviewer: {
28-
/** The kind of reviewer, such as `Team` or `User`. */
29-
__typename: string;
30-
/** The team slug, only set for a team. */
31-
slug?: string;
32-
} | null;
28+
requestedReviewer: { __typename: string; slug?: string } | null;
3329
}[];
3430
};
35-
/** The latest commit, which holds the checks state. */
3631
commits: {
37-
nodes: {
38-
commit: {
39-
/** The combined state of the checks, `null` when there are none. */
40-
statusCheckRollup: { state: string } | null;
41-
};
42-
}[];
32+
nodes: { commit: { statusCheckRollup: { state: string } | null } }[];
4333
};
4434
}[];
4535
};

‎.github/scripts/dependabot-pr-reminder/slack-payload.mts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ import type { Topology } from '../shared/topology.mts';
1010
import { describeUpdate } from './dependabot-title.mts';
1111
import type { PullRequest, Reminder } from './types.mts';
1212

13-
/** A Slack block the reminder uses. */
13+
/**
14+
* A Slack block the reminder uses: a text block, a header whose `text` is the
15+
* heading, a context block whose `elements` are the small text, or a divider.
16+
*/
1417
type ReminderBlock =
1518
| SlackBlock
1619
| {
1720
type: 'header';
18-
/** The heading text. */
1921
text: { type: 'plain_text'; text: string; emoji: true };
2022
}
21-
| {
22-
type: 'context';
23-
/** The small text shown in the block. */
24-
elements: { type: 'mrkdwn'; text: string }[];
25-
}
23+
| { type: 'context'; elements: { type: 'mrkdwn'; text: string }[] }
2624
| { type: 'divider' };
2725

2826
const CI: Record<
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
/** An open Dependabot pull request. */
1+
/**
2+
* An open Dependabot pull request.
3+
*
4+
* @property number - The pull request number.
5+
* @property title - The pull request title.
6+
* @property url - The link to the pull request.
7+
* @property requestedTeams - The slugs of the teams still requested as reviewers.
8+
* @property ciState - The state of the latest commit's checks, `unknown` when there are none.
9+
*/
210
export type PullRequest = {
3-
/** The pull request number. */
411
number: number;
5-
/** The pull request title. */
612
title: string;
7-
/** The link to the pull request. */
813
url: string;
9-
/** The slugs of the teams still requested as reviewers. */
1014
requestedTeams: string[];
11-
/** The state of the latest commit's checks, `unknown` when there are none. */
1215
ciState: 'passing' | 'failing' | 'pending' | 'unknown';
1316
};
1417

15-
/** The PRs to remind about, grouped by who handles them. */
18+
/**
19+
* The PRs to remind about, grouped by who handles them.
20+
*
21+
* @property byTeam - The PRs each team owns, keyed by team slug.
22+
* @property maintainer - The PRs the maintainer team handles.
23+
* @property maintainer.sharedByManyTeams - The PRs with more teams than the shared team threshold.
24+
* @property maintainer.noTeam - The PRs with no team to own them.
25+
*/
1626
export type Reminder = {
17-
/** The PRs each team owns, keyed by team slug. */
1827
byTeam: Map<string, PullRequest[]>;
19-
/** The PRs the maintainer team handles. */
2028
maintainer: {
21-
/** The PRs with more teams than the shared team threshold. */
2229
sharedByManyTeams: PullRequest[];
23-
/** The PRs with no team to own them. */
2430
noTeam: PullRequest[];
2531
};
2632
};

0 commit comments

Comments
 (0)