@theholocron/github-client 1.35.0 → 1.36.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/README.md CHANGED
@@ -53,6 +53,15 @@ const blob = await client.git.createBlob("owner/name", "file contents");
53
53
  | `git` | `getRef`, `getCommit`, `getTree`, `getContents`, `createBlob`, `createTree`, `createCommit`, `createRef`, `updateRef`, `createPull` |
54
54
  | `checks` | `createCheckRun` |
55
55
 
56
+ GitHub accepts at most 50 annotations per check-run request. Slice with the
57
+ exported `MAX_CHECK_RUN_ANNOTATIONS` constant rather than hardcoding it:
58
+
59
+ ```ts
60
+ import { MAX_CHECK_RUN_ANNOTATIONS } from "@theholocron/github-client";
61
+
62
+ output.annotations = findings.slice(0, MAX_CHECK_RUN_ANNOTATIONS);
63
+ ```
64
+
56
65
  ## Webhooks
57
66
 
58
67
  GitHub's own inbound-webhook mechanics — signature verification and
package/dist/index.d.mts CHANGED
@@ -15,6 +15,13 @@ interface GitHubClientOptions {
15
15
  type CheckRunStatus = "queued" | "in_progress" | "completed";
16
16
  type CheckRunConclusion = "success" | "failure" | "neutral" | "cancelled" | "timed_out" | "action_required" | "skipped";
17
17
  type CheckRunAnnotationLevel = "notice" | "warning" | "failure";
18
+ /**
19
+ * GitHub's cap on `output.annotations` per `createCheckRun()` /
20
+ * `updateCheckRun()` request. More than this needs a follow-up
21
+ * `updateCheckRun()` PATCH per GitHub's own docs, which this client doesn't
22
+ * do for you; slice with it rather than hardcoding the number.
23
+ */
24
+ declare const MAX_CHECK_RUN_ANNOTATIONS = 50;
18
25
  interface CheckRunAnnotation {
19
26
  /** File path relative to the repo root. */
20
27
  path: string;
@@ -37,9 +44,9 @@ interface CheckRunOutput {
37
44
  summary: string;
38
45
  text?: string;
39
46
  /**
40
- * Inline PR annotations — up to 50 per request. Sending more requires a
41
- * follow-up `updateCheckRun()` PATCH per GitHub's own docs; this client
42
- * doesn't paginate them for you.
47
+ * Inline PR annotations — up to {@link MAX_CHECK_RUN_ANNOTATIONS} per
48
+ * request. Sending more requires a follow-up `updateCheckRun()` PATCH per
49
+ * GitHub's own docs; this client doesn't paginate them for you.
43
50
  */
44
51
  annotations?: CheckRunAnnotation[];
45
52
  }
@@ -590,4 +597,4 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
590
597
  };
591
598
  type GitHubClient = ReturnType<typeof createGitHubClient>;
592
599
  //#endregion
593
- export { type CheckRunAnnotation, type CheckRunAnnotationLevel, type CheckRunConclusion, type CheckRunOutput, type CheckRunStatus, type CodeScanningSetupResult, type CreateCheckRunInput, type CreatePagesPayload, type CreatePullInput, type CreateReviewComment, type CreateReviewInput, type GitBlob, type GitCommit, type GitContents, type GitHubAppCredentials, type GitHubCheckRun, GitHubClient, type GitHubClientOptions, type GitHubContents, type GitHubEnvironment, type GitHubInstallationWebhookPayload, type GitHubIssue, type GitHubLabel, type GitHubMilestone, type GitHubPages, type GitHubPublicKey, type GitHubPullRequest, type GitHubPullRequestCommit, type GitHubPullRequestFile, type GitHubPullRequestReview, type GitHubPullRequestWebhookPayload, type GitHubPushWebhookPayload, type GitHubRepo, type GitHubRuleset, type GitHubUser, type GitHubWebhookHeaders, type GitHubWorkflowRun, type GitPull, type GitRef, type GitTree, type GitTreeItem, type InstallationAccessToken, type IssueSearchParams, type PagesBuildStatus, type PagesBuildType, type ReviewThread, type SecretScope, type TeamPermission, type UpdateCheckRunInput, type UpdatePagesPayload, type WorkflowRunFilter, createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
600
+ export { type CheckRunAnnotation, type CheckRunAnnotationLevel, type CheckRunConclusion, type CheckRunOutput, type CheckRunStatus, type CodeScanningSetupResult, type CreateCheckRunInput, type CreatePagesPayload, type CreatePullInput, type CreateReviewComment, type CreateReviewInput, type GitBlob, type GitCommit, type GitContents, type GitHubAppCredentials, type GitHubCheckRun, GitHubClient, type GitHubClientOptions, type GitHubContents, type GitHubEnvironment, type GitHubInstallationWebhookPayload, type GitHubIssue, type GitHubLabel, type GitHubMilestone, type GitHubPages, type GitHubPublicKey, type GitHubPullRequest, type GitHubPullRequestCommit, type GitHubPullRequestFile, type GitHubPullRequestReview, type GitHubPullRequestWebhookPayload, type GitHubPushWebhookPayload, type GitHubRepo, type GitHubRuleset, type GitHubUser, type GitHubWebhookHeaders, type GitHubWorkflowRun, type GitPull, type GitRef, type GitTree, type GitTreeItem, type InstallationAccessToken, type IssueSearchParams, MAX_CHECK_RUN_ANNOTATIONS, type PagesBuildStatus, type PagesBuildType, type ReviewThread, type SecretScope, type TeamPermission, type UpdateCheckRunInput, type UpdatePagesPayload, type WorkflowRunFilter, createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
package/dist/index.mjs CHANGED
@@ -68,6 +68,13 @@ function branches(rest) {
68
68
  }
69
69
  //#endregion
70
70
  //#region ../../../../../src/checks/checks.ts
71
+ /**
72
+ * GitHub's cap on `output.annotations` per `createCheckRun()` /
73
+ * `updateCheckRun()` request. More than this needs a follow-up
74
+ * `updateCheckRun()` PATCH per GitHub's own docs, which this client doesn't
75
+ * do for you; slice with it rather than hardcoding the number.
76
+ */
77
+ const MAX_CHECK_RUN_ANNOTATIONS = 50;
71
78
  function checks(rest) {
72
79
  return {
73
80
  createCheckRun: (repo, input) => rest.request(`${repoBase(repo)}/check-runs`, {
@@ -730,4 +737,4 @@ function createGitHubClient(opts) {
730
737
  };
731
738
  }
732
739
  //#endregion
733
- export { createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
740
+ export { MAX_CHECK_RUN_ANNOTATIONS, createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "description": "A TypeScript client for the GitHub REST API",
5
5
  "keywords": [
6
6
  "github",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@theholocron/observability": "^0.3.0",
36
- "@theholocron/http-client": "^1.35.0"
36
+ "@theholocron/http-client": "^1.36.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@theholocron/cli": "5.0.0-alpha.79",