@theholocron/holocron-plugin-github 5.0.0-alpha.260 → 5.0.0-alpha.262

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
@@ -1,4 +1,4 @@
1
- import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, PagesConfig, PullRequest, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, SourceFile, SourceTeamMember, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
1
+ import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, PagesConfig, PullRequest, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, SourceBranch, SourceFile, SourceTeamMember, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
2
2
  import { GitHubClient, GitHubClientOptions, createGitHubClient } from "@theholocron/github-client";
3
3
  export declare const resolveReadToken: (input?: ResolveTokenInput) => string;
4
4
  export declare const resolveIssuesToken: (input?: ResolveTokenInput) => string;
@@ -182,6 +182,10 @@ export declare class GitHubSource implements Source {
182
182
  syncDescription(description: string): Promise<string>;
183
183
  syncHomepage(homepage: string): Promise<string>;
184
184
  getPullRequest(number: number, repo?: string): Promise<PullRequest>;
185
+ listPullRequests(state: "open" | "closed", repo?: string): Promise<PullRequest[]>;
186
+ listBranches(repo?: string): Promise<SourceBranch[]>;
187
+ deleteBranch(name: string, repo?: string): Promise<void>;
188
+ listPullRequestCommits(number: number, repo?: string): Promise<string[]>;
185
189
  configurePages(config: PagesConfig, token: string): Promise<void>;
186
190
  }
187
191
  interface NormalizedTeamEntry {
package/dist/index.mjs CHANGED
@@ -691,6 +691,17 @@ function syncOrgVariables(client, repo, org, variables, opts = {}) {
691
691
  });
692
692
  }
693
693
  // src/capabilities/source.ts
694
+ function toPullRequest(raw) {
695
+ return {
696
+ number: raw.number,
697
+ title: raw.title,
698
+ state: raw.state,
699
+ merged: raw.merged_at !== null,
700
+ branch: raw.head.ref,
701
+ headSha: raw.head.sha,
702
+ url: raw.html_url
703
+ };
704
+ }
694
705
  var GitHubSource = class {
695
706
  client;
696
707
  key = "source";
@@ -840,15 +851,27 @@ var GitHubSource = class {
840
851
  return "homepage updated";
841
852
  }
842
853
  async getPullRequest(number, repo) {
843
- const raw = await this.client.pulls.getPullRequest(repo ?? this.repo, number);
844
- return {
845
- number: raw.number,
846
- title: raw.title,
847
- state: raw.state,
848
- merged: raw.merged_at !== null,
849
- branch: raw.head.ref,
850
- url: raw.html_url
851
- };
854
+ return toPullRequest(await this.client.pulls.getPullRequest(repo ?? this.repo, number));
855
+ }
856
+ async listPullRequests(state, repo) {
857
+ return (await this.client.pulls.listPullRequests(repo ?? this.repo, state)).map(toPullRequest);
858
+ }
859
+ async listBranches(repo) {
860
+ return (await this.client.branches.listBranches(repo ?? this.repo)).map((b) => ({
861
+ name: b.name,
862
+ sha: b.commit.sha
863
+ }));
864
+ }
865
+ async deleteBranch(name, repo) {
866
+ try {
867
+ await this.client.branches.removeBranch(repo ?? this.repo, name);
868
+ } catch (err) {
869
+ if (err instanceof ProviderApiError && err.status === 422 && String(err.details).includes("does not exist")) return;
870
+ throw err;
871
+ }
872
+ }
873
+ async listPullRequestCommits(number, repo) {
874
+ return (await this.client.pulls.listCommits(repo ?? this.repo, number)).map((commit) => commit.sha);
852
875
  }
853
876
  async configurePages(config, token) {
854
877
  const pagesClient = createGitHubClient$1({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-github",
3
- "version": "5.0.0-alpha.260",
3
+ "version": "5.0.0-alpha.262",
4
4
  "description": "Holocron plugin for GitHub. Implements source, ci, secrets, environments, and issues capabilities against the GitHub REST API.",
5
5
  "keywords": [
6
6
  "ci",
@@ -44,21 +44,21 @@
44
44
  "tsx": "4.23.15",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^5.0.5",
47
- "@theholocron/cli": "5.0.0-alpha.260",
47
+ "@theholocron/cli": "5.0.0-alpha.262",
48
48
  "@theholocron/fs-utils": "^1.16.1-alpha.1",
49
49
  "@theholocron/eslint-config": "^8.9.0-alpha.3",
50
- "@theholocron/github-client": "^1.57.1-alpha.2",
50
+ "@theholocron/http-client": "^1.58.0-alpha.1",
51
+ "@theholocron/github-client": "^1.58.0-alpha.1",
51
52
  "@theholocron/misc-utils": "^1.16.1-alpha.1",
52
53
  "@theholocron/tsdown-config": "^8.9.0-alpha.3",
53
- "@theholocron/vitest-config": "^8.9.0-alpha.3",
54
54
  "@theholocron/tsconfig": "^8.9.0-alpha.3",
55
- "@theholocron/http-client": "^1.57.1-alpha.2"
55
+ "@theholocron/vitest-config": "^8.9.0-alpha.3"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@theholocron/fs-utils": "^1.16.0",
59
59
  "@theholocron/github-client": "^1.51.0",
60
60
  "@theholocron/misc-utils": "^1.16.0",
61
- "@theholocron/cli": "5.0.0-alpha.260"
61
+ "@theholocron/cli": "5.0.0-alpha.262"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"