@theholocron/github-client 1.27.0 → 1.29.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 +19 -1
- package/dist/index.mjs +36 -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 {
|
|
@@ -196,6 +204,13 @@ interface GitHubPullRequestCommit {
|
|
|
196
204
|
message: string;
|
|
197
205
|
};
|
|
198
206
|
}
|
|
207
|
+
/** One file as returned by `GET /pulls/{pull_number}/files` — only the fields any known consumer needs. */
|
|
208
|
+
interface GitHubPullRequestFile {
|
|
209
|
+
filename: string;
|
|
210
|
+
status: "added" | "removed" | "modified" | "renamed" | "copied" | "changed" | "unchanged";
|
|
211
|
+
/** Set only when `status === "renamed"`. */
|
|
212
|
+
previous_filename?: string;
|
|
213
|
+
}
|
|
199
214
|
//#endregion
|
|
200
215
|
//#region src/repos/repos.d.ts
|
|
201
216
|
interface GitHubRepo {
|
|
@@ -366,6 +381,7 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
366
381
|
};
|
|
367
382
|
checks: {
|
|
368
383
|
createCheckRun: (repo: string, input: CreateCheckRunInput) => Promise<GitHubCheckRun>;
|
|
384
|
+
updateCheckRun: (repo: string, checkRunId: number, input: UpdateCheckRunInput) => Promise<GitHubCheckRun>;
|
|
369
385
|
};
|
|
370
386
|
environments: {
|
|
371
387
|
listEnvironments: (repo: string) => Promise<GitHubEnvironment[]>;
|
|
@@ -425,6 +441,7 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
425
441
|
pulls: {
|
|
426
442
|
getPullRequest: (repo: string, number: number) => Promise<GitHubPullRequest>;
|
|
427
443
|
listCommits: (repo: string, number: number) => Promise<GitHubPullRequestCommit[]>;
|
|
444
|
+
listFiles: (repo: string, number: number) => Promise<GitHubPullRequestFile[]>;
|
|
428
445
|
};
|
|
429
446
|
repos: {
|
|
430
447
|
getRepo: (repo: string) => Promise<GitHubRepo>;
|
|
@@ -463,8 +480,9 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
463
480
|
workflows: {
|
|
464
481
|
listRuns: (repo: string, filter?: WorkflowRunFilter) => Promise<GitHubWorkflowRun[]>;
|
|
465
482
|
getRun: (repo: string, id: string | number) => Promise<GitHubWorkflowRun>;
|
|
483
|
+
createWorkflowDispatch: (repo: string, workflowFile: string, ref: string, inputs?: Record<string, string>) => Promise<void>;
|
|
466
484
|
};
|
|
467
485
|
};
|
|
468
486
|
type GitHubClient = ReturnType<typeof createGitHubClient>;
|
|
469
487
|
//#endregion
|
|
470
|
-
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 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
|
|
@@ -224,7 +231,14 @@ function pulls(rest) {
|
|
|
224
231
|
* commits (GitHub caps this endpoint at 250 regardless of pagination)
|
|
225
232
|
* is an edge case no consumer here needs to paginate for today.
|
|
226
233
|
*/
|
|
227
|
-
listCommits: (repo, number) => rest.request(`${repoBase(repo)}/pulls/${number}/commits?per_page=100`)
|
|
234
|
+
listCommits: (repo, number) => rest.request(`${repoBase(repo)}/pulls/${number}/commits?per_page=100`),
|
|
235
|
+
/**
|
|
236
|
+
* A PR's own changed files. `per_page=100` — GitHub's max — covers
|
|
237
|
+
* every real PR in this org; a PR genuinely exceeding 100 changed
|
|
238
|
+
* files (GitHub caps this endpoint at 3000 regardless of pagination)
|
|
239
|
+
* is an edge case no consumer here needs to paginate for today.
|
|
240
|
+
*/
|
|
241
|
+
listFiles: (repo, number) => rest.request(`${repoBase(repo)}/pulls/${number}/files?per_page=100`)
|
|
228
242
|
};
|
|
229
243
|
}
|
|
230
244
|
//#endregion
|
|
@@ -358,7 +372,23 @@ function workflows(rest) {
|
|
|
358
372
|
const path = qs ? `${repoBase(repo)}/actions/runs?${qs}` : `${repoBase(repo)}/actions/runs`;
|
|
359
373
|
return rest.request(path).then((r) => r.workflow_runs);
|
|
360
374
|
},
|
|
361
|
-
getRun: (repo, id) => rest.request(`${repoBase(repo)}/actions/runs/${id}`)
|
|
375
|
+
getRun: (repo, id) => rest.request(`${repoBase(repo)}/actions/runs/${id}`),
|
|
376
|
+
/**
|
|
377
|
+
* Triggers a `workflow_dispatch` run. `workflowFile` is the workflow's
|
|
378
|
+
* filename (e.g. `"platform.dispatchedCheck.yml"`) — GitHub accepts the
|
|
379
|
+
* filename directly, no numeric workflow ID lookup needed. Fire-and-forget:
|
|
380
|
+
* the API returns `204` with no run ID, so callers needing to correlate
|
|
381
|
+
* the resulting run back to this call must pass their own correlation
|
|
382
|
+
* value through `inputs` (visible in the Actions UI/logs — never a secret).
|
|
383
|
+
*/
|
|
384
|
+
createWorkflowDispatch: (repo, workflowFile, ref, inputs) => rest.request(`${repoBase(repo)}/actions/workflows/${workflowFile}/dispatches`, {
|
|
385
|
+
method: "POST",
|
|
386
|
+
body: {
|
|
387
|
+
ref,
|
|
388
|
+
inputs
|
|
389
|
+
},
|
|
390
|
+
expectNoContent: true
|
|
391
|
+
})
|
|
362
392
|
};
|
|
363
393
|
}
|
|
364
394
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/github-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.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.29.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@theholocron/cli": "5.0.0-alpha.33",
|