@theholocron/github-client 1.7.0 → 1.8.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
@@ -113,6 +113,37 @@ interface GitHubLabel {
113
113
  description: string | null;
114
114
  }
115
115
  //#endregion
116
+ //#region src/pages/pages.d.ts
117
+ type PagesBuildType = "workflow" | "legacy";
118
+ type PagesBuildStatus = "built" | "building" | "errored" | "unknown";
119
+ interface GitHubPages {
120
+ status: PagesBuildStatus | null;
121
+ build_type: PagesBuildType | null;
122
+ source?: {
123
+ branch: string;
124
+ path: string;
125
+ };
126
+ https_enforced: boolean;
127
+ custom_domain: string | null;
128
+ }
129
+ interface CreatePagesPayload {
130
+ build_type: PagesBuildType;
131
+ /** Required when build_type is "legacy". */
132
+ source?: {
133
+ branch: string;
134
+ path: string;
135
+ };
136
+ }
137
+ interface UpdatePagesPayload {
138
+ build_type?: PagesBuildType;
139
+ source?: {
140
+ branch: string;
141
+ path: string;
142
+ };
143
+ cname?: string | null;
144
+ https_enforced?: boolean;
145
+ }
146
+ //#endregion
116
147
  //#region src/repos/repos.d.ts
117
148
  interface GitHubRepo {
118
149
  default_branch: string;
@@ -232,6 +263,11 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
232
263
  }) => Promise<GitHubLabel>;
233
264
  deleteLabel: (repo: string, name: string) => Promise<void>;
234
265
  };
266
+ pages: {
267
+ getPages: (repo: string) => Promise<GitHubPages | null>;
268
+ createPages: (repo: string, payload: CreatePagesPayload) => Promise<GitHubPages>;
269
+ updatePages: (repo: string, payload: UpdatePagesPayload) => Promise<void>;
270
+ };
235
271
  properties: {
236
272
  setProperties: (repo: string, values: Record<string, string>) => Promise<void>;
237
273
  };
@@ -276,4 +312,4 @@ declare function createGitHubClient(opts: GitHubClientOptions): {
276
312
  };
277
313
  type GitHubClient = ReturnType<typeof createGitHubClient>;
278
314
  //#endregion
279
- export { type CodeScanningSetupResult, type CreatePullInput, type GitBlob, type GitCommit, type GitContents, GitHubClient, type GitHubClientOptions, type GitHubContents, type GitHubEnvironment, type GitHubIssue, type GitHubLabel, type GitHubMilestone, type GitHubPublicKey, type GitHubRepo, type GitHubRuleset, type GitHubUser, type GitHubWorkflowRun, type GitPull, type GitRef, type GitTree, type GitTreeItem, type IssueSearchParams, type SecretScope, type TeamPermission, type WorkflowRunFilter, createGitHubClient };
315
+ export { type CodeScanningSetupResult, type CreatePagesPayload, type CreatePullInput, type GitBlob, type GitCommit, type GitContents, GitHubClient, type GitHubClientOptions, type GitHubContents, type GitHubEnvironment, type GitHubIssue, type GitHubLabel, type GitHubMilestone, type GitHubPages, type GitHubPublicKey, type GitHubRepo, type GitHubRuleset, type GitHubUser, type GitHubWorkflowRun, type GitPull, type GitRef, type GitTree, type GitTreeItem, type IssueSearchParams, type PagesBuildStatus, type PagesBuildType, type SecretScope, type TeamPermission, type UpdatePagesPayload, type WorkflowRunFilter, createGitHubClient };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createRestClient } from "@theholocron/http-client";
1
+ import { ProviderApiError, createRestClient } from "@theholocron/http-client";
2
2
  //#region src/utils.ts
3
3
  function createGitHubRestClient(opts) {
4
4
  return createRestClient({
@@ -148,6 +148,38 @@ function labels(rest) {
148
148
  };
149
149
  }
150
150
  //#endregion
151
+ //#region src/pages/pages.ts
152
+ function pages(rest) {
153
+ return {
154
+ /** Returns null when Pages is not yet enabled (404). */
155
+ getPages: async (repo) => {
156
+ try {
157
+ return await rest.request(`${repoBase(repo)}/pages`);
158
+ } catch (err) {
159
+ if (err instanceof ProviderApiError && err.status === 404) return null;
160
+ throw err;
161
+ }
162
+ },
163
+ /**
164
+ * Enables Pages for the first time.
165
+ * Throws on all errors except 409 Conflict (already enabled — callers
166
+ * should catch that and fall through to updatePages).
167
+ */
168
+ createPages: (repo, payload) => rest.request(`${repoBase(repo)}/pages`, {
169
+ method: "POST",
170
+ body: payload
171
+ }),
172
+ /**
173
+ * Updates Pages settings on an existing site (build type, cname, https).
174
+ * GitHub returns 204 No Content.
175
+ */
176
+ updatePages: (repo, payload) => rest.request(`${repoBase(repo)}/pages`, {
177
+ method: "PUT",
178
+ body: payload
179
+ })
180
+ };
181
+ }
182
+ //#endregion
151
183
  //#region src/properties/properties.ts
152
184
  function properties(rest) {
153
185
  return { setProperties: (repo, values) => {
@@ -305,6 +337,7 @@ function createGitHubClient(opts) {
305
337
  git: git(rest),
306
338
  issues: issues(rest),
307
339
  labels: labels(rest),
340
+ pages: pages(rest),
308
341
  properties: properties(rest),
309
342
  repos: repos(rest),
310
343
  rulesets: rulesets(rest),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "A TypeScript client for the GitHub REST API",
5
5
  "homepage": "https://github.com/theholocron/clients/tree/main/packages/github-client#readme",
6
6
  "bugs": "https://github.com/theholocron/clients/issues",
@@ -30,7 +30,7 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@theholocron/http-client": "^1.7.0"
33
+ "@theholocron/http-client": "^1.8.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^26.2.0",