@theholocron/github-client 1.29.0 → 1.31.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.d.mts CHANGED
@@ -14,10 +14,34 @@ interface GitHubClientOptions {
14
14
  //#region src/checks/checks.d.ts
15
15
  type CheckRunStatus = "queued" | "in_progress" | "completed";
16
16
  type CheckRunConclusion = "success" | "failure" | "neutral" | "cancelled" | "timed_out" | "action_required" | "skipped";
17
+ type CheckRunAnnotationLevel = "notice" | "warning" | "failure";
18
+ interface CheckRunAnnotation {
19
+ /** File path relative to the repo root. */
20
+ path: string;
21
+ /** 1-indexed. */
22
+ start_line: number;
23
+ end_line: number;
24
+ /** Only valid when `start_line === end_line`. */
25
+ start_column?: number;
26
+ end_column?: number;
27
+ annotation_level: CheckRunAnnotationLevel;
28
+ /** Max 64KB. */
29
+ message: string;
30
+ /** Max 255 characters. */
31
+ title?: string;
32
+ /** Max 64KB. */
33
+ raw_details?: string;
34
+ }
17
35
  interface CheckRunOutput {
18
36
  title: string;
19
37
  summary: string;
20
38
  text?: string;
39
+ /**
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.
43
+ */
44
+ annotations?: CheckRunAnnotation[];
21
45
  }
22
46
  interface CreateCheckRunInput {
23
47
  name: string;
@@ -392,7 +416,7 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
392
416
  getRef: (repo: string, branch: string) => Promise<GitRef>;
393
417
  getCommit: (repo: string, sha: string) => Promise<GitCommit>;
394
418
  getTree: (repo: string, sha: string, recursive?: boolean) => Promise<GitTree>;
395
- getContents: (repo: string, path: string) => Promise<GitContents>;
419
+ getContents: (repo: string, path: string, ref?: string) => Promise<GitContents>;
396
420
  createBlob: (repo: string, content: string, encoding?: string) => Promise<GitBlob>;
397
421
  createTree: (repo: string, tree: Array<{
398
422
  path: string;
@@ -485,4 +509,4 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
485
509
  };
486
510
  type GitHubClient = ReturnType<typeof createGitHubClient>;
487
511
  //#endregion
488
- export { type CheckRunConclusion, type CheckRunOutput, type CheckRunStatus, type CodeScanningSetupResult, type CreateCheckRunInput, type CreatePagesPayload, type CreatePullInput, 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 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 SecretScope, type TeamPermission, type UpdateCheckRunInput, type UpdatePagesPayload, type WorkflowRunFilter, createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
512
+ export { type CheckRunAnnotation, type CheckRunAnnotationLevel, type CheckRunConclusion, type CheckRunOutput, type CheckRunStatus, type CodeScanningSetupResult, type CreateCheckRunInput, type CreatePagesPayload, type CreatePullInput, 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 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 SecretScope, type TeamPermission, type UpdateCheckRunInput, type UpdatePagesPayload, type WorkflowRunFilter, createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
package/dist/index.mjs CHANGED
@@ -65,7 +65,15 @@ function git(rest) {
65
65
  getRef: (repo, branch) => rest.request(`${repoBase(repo)}/git/ref/heads/${branch}`),
66
66
  getCommit: (repo, sha) => rest.request(`${repoBase(repo)}/git/commits/${sha}`),
67
67
  getTree: (repo, sha, recursive = false) => rest.request(`${repoBase(repo)}/git/trees/${sha}${recursive ? "?recursive=1" : ""}`),
68
- getContents: (repo, path) => rest.request(`${repoBase(repo)}/contents/${path}`),
68
+ /**
69
+ * `ref` defaults to the repo's default branch (GitHub's own default)
70
+ * when omitted — the security-relevant choice every existing caller
71
+ * relies on (D4/D6, `validateConfig()`'s own docstring). Pass it
72
+ * explicitly to read a specific commit/branch's content instead — a
73
+ * same-repo PR branch is no longer a new trust boundary for this org
74
+ * (D6-amended, `tech-sentinel-ci-runner.spec.md`), just never a fork's.
75
+ */
76
+ getContents: (repo, path, ref) => rest.request(`${repoBase(repo)}/contents/${path}`, ref ? { query: { ref } } : void 0),
69
77
  createBlob: (repo, content, encoding = "utf-8") => rest.request(`${repoBase(repo)}/git/blobs`, {
70
78
  method: "POST",
71
79
  body: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.29.0",
3
+ "version": "1.31.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.29.0"
36
+ "@theholocron/http-client": "^1.31.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@theholocron/cli": "5.0.0-alpha.33",