@theholocron/github-client 1.28.0 → 1.30.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 +12 -2
- package/dist/index.mjs +37 -6
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,14 @@ interface GitHubCheckRun {
|
|
|
39
39
|
conclusion: CheckRunConclusion | null;
|
|
40
40
|
html_url: string;
|
|
41
41
|
}
|
|
42
|
+
interface UpdateCheckRunInput {
|
|
43
|
+
status?: CheckRunStatus;
|
|
44
|
+
/** Required when `status` is `"completed"`. */
|
|
45
|
+
conclusion?: CheckRunConclusion;
|
|
46
|
+
output?: CheckRunOutput;
|
|
47
|
+
/** URL for the "Details" link on the check run. */
|
|
48
|
+
details_url?: string;
|
|
49
|
+
}
|
|
42
50
|
//#endregion
|
|
43
51
|
//#region src/environments/environments.d.ts
|
|
44
52
|
interface GitHubEnvironment {
|
|
@@ -373,6 +381,7 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
373
381
|
};
|
|
374
382
|
checks: {
|
|
375
383
|
createCheckRun: (repo: string, input: CreateCheckRunInput) => Promise<GitHubCheckRun>;
|
|
384
|
+
updateCheckRun: (repo: string, checkRunId: number, input: UpdateCheckRunInput) => Promise<GitHubCheckRun>;
|
|
376
385
|
};
|
|
377
386
|
environments: {
|
|
378
387
|
listEnvironments: (repo: string) => Promise<GitHubEnvironment[]>;
|
|
@@ -383,7 +392,7 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
383
392
|
getRef: (repo: string, branch: string) => Promise<GitRef>;
|
|
384
393
|
getCommit: (repo: string, sha: string) => Promise<GitCommit>;
|
|
385
394
|
getTree: (repo: string, sha: string, recursive?: boolean) => Promise<GitTree>;
|
|
386
|
-
getContents: (repo: string, path: string) => Promise<GitContents>;
|
|
395
|
+
getContents: (repo: string, path: string, ref?: string) => Promise<GitContents>;
|
|
387
396
|
createBlob: (repo: string, content: string, encoding?: string) => Promise<GitBlob>;
|
|
388
397
|
createTree: (repo: string, tree: Array<{
|
|
389
398
|
path: string;
|
|
@@ -471,8 +480,9 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
471
480
|
workflows: {
|
|
472
481
|
listRuns: (repo: string, filter?: WorkflowRunFilter) => Promise<GitHubWorkflowRun[]>;
|
|
473
482
|
getRun: (repo: string, id: string | number) => Promise<GitHubWorkflowRun>;
|
|
483
|
+
createWorkflowDispatch: (repo: string, workflowFile: string, ref: string, inputs?: Record<string, string>) => Promise<void>;
|
|
474
484
|
};
|
|
475
485
|
};
|
|
476
486
|
type GitHubClient = ReturnType<typeof createGitHubClient>;
|
|
477
487
|
//#endregion
|
|
478
|
-
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 UpdatePagesPayload, type WorkflowRunFilter, createAppJWT, createGitHubClient, createInstallationClient, getInstallationAccessToken, parseGitHubWebhookHeaders, verifyGitHubWebhookSignature };
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -31,10 +31,17 @@ function branches(rest) {
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/checks/checks.ts
|
|
33
33
|
function checks(rest) {
|
|
34
|
-
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
return {
|
|
35
|
+
createCheckRun: (repo, input) => rest.request(`${repoBase(repo)}/check-runs`, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
body: input
|
|
38
|
+
}),
|
|
39
|
+
/** Patches an existing check run — used to move a `"queued"` run posted before a dispatched task ran to `"completed"` once it finishes. */
|
|
40
|
+
updateCheckRun: (repo, checkRunId, input) => rest.request(`${repoBase(repo)}/check-runs/${checkRunId}`, {
|
|
41
|
+
method: "PATCH",
|
|
42
|
+
body: input
|
|
43
|
+
})
|
|
44
|
+
};
|
|
38
45
|
}
|
|
39
46
|
//#endregion
|
|
40
47
|
//#region src/environments/environments.ts
|
|
@@ -58,7 +65,15 @@ function git(rest) {
|
|
|
58
65
|
getRef: (repo, branch) => rest.request(`${repoBase(repo)}/git/ref/heads/${branch}`),
|
|
59
66
|
getCommit: (repo, sha) => rest.request(`${repoBase(repo)}/git/commits/${sha}`),
|
|
60
67
|
getTree: (repo, sha, recursive = false) => rest.request(`${repoBase(repo)}/git/trees/${sha}${recursive ? "?recursive=1" : ""}`),
|
|
61
|
-
|
|
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),
|
|
62
77
|
createBlob: (repo, content, encoding = "utf-8") => rest.request(`${repoBase(repo)}/git/blobs`, {
|
|
63
78
|
method: "POST",
|
|
64
79
|
body: {
|
|
@@ -365,7 +380,23 @@ function workflows(rest) {
|
|
|
365
380
|
const path = qs ? `${repoBase(repo)}/actions/runs?${qs}` : `${repoBase(repo)}/actions/runs`;
|
|
366
381
|
return rest.request(path).then((r) => r.workflow_runs);
|
|
367
382
|
},
|
|
368
|
-
getRun: (repo, id) => rest.request(`${repoBase(repo)}/actions/runs/${id}`)
|
|
383
|
+
getRun: (repo, id) => rest.request(`${repoBase(repo)}/actions/runs/${id}`),
|
|
384
|
+
/**
|
|
385
|
+
* Triggers a `workflow_dispatch` run. `workflowFile` is the workflow's
|
|
386
|
+
* filename (e.g. `"platform.dispatchedCheck.yml"`) — GitHub accepts the
|
|
387
|
+
* filename directly, no numeric workflow ID lookup needed. Fire-and-forget:
|
|
388
|
+
* the API returns `204` with no run ID, so callers needing to correlate
|
|
389
|
+
* the resulting run back to this call must pass their own correlation
|
|
390
|
+
* value through `inputs` (visible in the Actions UI/logs — never a secret).
|
|
391
|
+
*/
|
|
392
|
+
createWorkflowDispatch: (repo, workflowFile, ref, inputs) => rest.request(`${repoBase(repo)}/actions/workflows/${workflowFile}/dispatches`, {
|
|
393
|
+
method: "POST",
|
|
394
|
+
body: {
|
|
395
|
+
ref,
|
|
396
|
+
inputs
|
|
397
|
+
},
|
|
398
|
+
expectNoContent: true
|
|
399
|
+
})
|
|
369
400
|
};
|
|
370
401
|
}
|
|
371
402
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/github-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.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.
|
|
36
|
+
"@theholocron/http-client": "^1.30.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@theholocron/cli": "5.0.0-alpha.33",
|