@theholocron/github-client 1.28.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 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[]>;
@@ -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 { createCheckRun: (repo, input) => rest.request(`${repoBase(repo)}/check-runs`, {
35
- method: "POST",
36
- body: input
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
@@ -365,7 +372,23 @@ function workflows(rest) {
365
372
  const path = qs ? `${repoBase(repo)}/actions/runs?${qs}` : `${repoBase(repo)}/actions/runs`;
366
373
  return rest.request(path).then((r) => r.workflow_runs);
367
374
  },
368
- 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
+ })
369
392
  };
370
393
  }
371
394
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.28.0",
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.28.0"
36
+ "@theholocron/http-client": "^1.29.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@theholocron/cli": "5.0.0-alpha.33",