@theholocron/holocron-plugin-github 3.12.3 → 3.13.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 +6 -2
- package/dist/index.mjs +23 -5
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ declare const resolveSyncToken: (input?: ResolveTokenInput) => string;
|
|
|
7
7
|
declare const resolveReleaseToken: (input?: ResolveTokenInput) => string;
|
|
8
8
|
declare const resolveAdminToken: (input?: ResolveTokenInput) => string;
|
|
9
9
|
declare const resolveDeployToken: (input?: ResolveTokenInput) => string;
|
|
10
|
+
declare const resolveOrgToken: (input?: ResolveTokenInput) => string;
|
|
10
11
|
//#endregion
|
|
11
12
|
//#region src/capabilities/ci.d.ts
|
|
12
13
|
interface CiOptions {
|
|
@@ -117,6 +118,8 @@ declare class GitHubSecrets implements Secrets {
|
|
|
117
118
|
interface SourceOptions {
|
|
118
119
|
repo: string;
|
|
119
120
|
repoRoot: string;
|
|
121
|
+
/** Secondary client authenticated with HOLOCRON_ORG_TOKEN for org-scoped operations (teams, custom properties). */
|
|
122
|
+
orgClient?: GitHubClient;
|
|
120
123
|
/** Forwarded to a secondary client created for Pages calls (HOLOCRON_DEPLOY_TOKEN). */
|
|
121
124
|
baseUrl?: string;
|
|
122
125
|
fetch?: typeof fetch;
|
|
@@ -130,6 +133,7 @@ declare class GitHubSource implements Source {
|
|
|
130
133
|
private readonly repo;
|
|
131
134
|
private readonly repoRoot;
|
|
132
135
|
private readonly workflowDir;
|
|
136
|
+
private readonly orgClient?;
|
|
133
137
|
private readonly baseUrl?;
|
|
134
138
|
private readonly fetchImpl?;
|
|
135
139
|
constructor(client: GitHubClient, opts: SourceOptions);
|
|
@@ -227,7 +231,7 @@ interface PluginContext {
|
|
|
227
231
|
repo: string;
|
|
228
232
|
repoRoot: string;
|
|
229
233
|
}
|
|
230
|
-
declare function source(ctx: PluginContext): Source;
|
|
234
|
+
declare function source(ctx: PluginContext, orgClient?: GitHubClient): Source;
|
|
231
235
|
declare function secrets(ctx: PluginContext): Secrets;
|
|
232
236
|
declare function environments(ctx: PluginContext): Environments;
|
|
233
237
|
declare function ci(ctx: PluginContext): Ci;
|
|
@@ -248,4 +252,4 @@ declare function createPlugin(options: GitHubPluginOptions): {
|
|
|
248
252
|
*/
|
|
249
253
|
declare const AUTH_HINT: string;
|
|
250
254
|
//#endregion
|
|
251
|
-
export { AUTH_HINT, type Auth, AuthError, type CanonicalLabel, GitHubCi, type GitHubClientOptions, GitHubEnvironments, GitHubIssues, GitHubPluginOptions, GitHubSecrets, GitHubSource, type NormalizedTeamEntry, PluginContext, type ResolveTokenInput, type TeamEntry, type TeamPermission, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, ci, createFeatureResolver, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveAdminToken, resolveDeployToken, resolveIssuesToken, resolveReadToken, resolveReleaseToken, resolveSyncToken, secrets, source, syncLabels, syncTeams, verifyToken };
|
|
255
|
+
export { AUTH_HINT, type Auth, AuthError, type CanonicalLabel, GitHubCi, type GitHubClientOptions, GitHubEnvironments, GitHubIssues, GitHubPluginOptions, GitHubSecrets, GitHubSource, type NormalizedTeamEntry, PluginContext, type ResolveTokenInput, type TeamEntry, type TeamPermission, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, ci, createFeatureResolver, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveAdminToken, resolveDeployToken, resolveIssuesToken, resolveOrgToken, resolveReadToken, resolveReleaseToken, resolveSyncToken, secrets, source, syncLabels, syncTeams, verifyToken };
|
package/dist/index.mjs
CHANGED
|
@@ -28,6 +28,10 @@ const resolveDeployToken = createFeatureResolver({
|
|
|
28
28
|
envName: "HOLOCRON_DEPLOY_TOKEN",
|
|
29
29
|
keyringKey: "github.deploy"
|
|
30
30
|
});
|
|
31
|
+
const resolveOrgToken = createFeatureResolver({
|
|
32
|
+
envName: "HOLOCRON_ORG_TOKEN",
|
|
33
|
+
keyringKey: "github.org"
|
|
34
|
+
});
|
|
31
35
|
//#endregion
|
|
32
36
|
//#region src/capabilities/ci.ts
|
|
33
37
|
var GitHubCi = class {
|
|
@@ -483,6 +487,7 @@ var GitHubSource = class {
|
|
|
483
487
|
repo;
|
|
484
488
|
repoRoot;
|
|
485
489
|
workflowDir;
|
|
490
|
+
orgClient;
|
|
486
491
|
baseUrl;
|
|
487
492
|
fetchImpl;
|
|
488
493
|
constructor(client, opts) {
|
|
@@ -493,6 +498,7 @@ var GitHubSource = class {
|
|
|
493
498
|
this.repo = opts.repo;
|
|
494
499
|
this.repoRoot = opts.repoRoot;
|
|
495
500
|
this.workflowDir = join(opts.repoRoot, ".github", "workflows");
|
|
501
|
+
this.orgClient = opts.orgClient;
|
|
496
502
|
this.baseUrl = opts.baseUrl;
|
|
497
503
|
this.fetchImpl = opts.fetch;
|
|
498
504
|
}
|
|
@@ -580,10 +586,10 @@ var GitHubSource = class {
|
|
|
580
586
|
return syncLabels(this.client, this.repo, canonical, stale);
|
|
581
587
|
}
|
|
582
588
|
async syncProperties(values) {
|
|
583
|
-
return syncProperties(this.client, this.repo, values);
|
|
589
|
+
return syncProperties(this.orgClient ?? this.client, this.repo, values);
|
|
584
590
|
}
|
|
585
591
|
async syncTeams(teams) {
|
|
586
|
-
return syncTeams(this.client, this.repo, teams);
|
|
592
|
+
return syncTeams(this.orgClient ?? this.client, this.repo, teams);
|
|
587
593
|
}
|
|
588
594
|
async syncTopics(topics) {
|
|
589
595
|
return syncTopics(this.client, this.repo, topics);
|
|
@@ -666,10 +672,11 @@ async function verifyToken(token, opts = {}) {
|
|
|
666
672
|
}
|
|
667
673
|
//#endregion
|
|
668
674
|
//#region src/index.ts
|
|
669
|
-
function source(ctx) {
|
|
675
|
+
function source(ctx, orgClient) {
|
|
670
676
|
return new GitHubSource(ctx.client, {
|
|
671
677
|
repo: ctx.repo,
|
|
672
678
|
repoRoot: ctx.repoRoot,
|
|
679
|
+
orgClient,
|
|
673
680
|
baseUrl: ctx.options.baseUrl,
|
|
674
681
|
fetch: ctx.options.fetch
|
|
675
682
|
});
|
|
@@ -701,10 +708,21 @@ function createPlugin(options) {
|
|
|
701
708
|
repoRoot: options.repoRoot ?? process.cwd()
|
|
702
709
|
};
|
|
703
710
|
}
|
|
711
|
+
function makeOrgClient() {
|
|
712
|
+
try {
|
|
713
|
+
return createGitHubClient$1({
|
|
714
|
+
token: resolveOrgToken(options),
|
|
715
|
+
baseUrl: options.baseUrl,
|
|
716
|
+
fetch: options.fetch
|
|
717
|
+
});
|
|
718
|
+
} catch {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
704
722
|
return {
|
|
705
723
|
name: "@theholocron/holocron-plugin-github",
|
|
706
724
|
capabilities: {
|
|
707
|
-
source: () => source(makeCtx(resolveAdminToken)),
|
|
725
|
+
source: () => source(makeCtx(resolveAdminToken), makeOrgClient()),
|
|
708
726
|
ci: () => ci(makeCtx(resolveReadToken)),
|
|
709
727
|
secrets: () => secrets(makeCtx(resolveAdminToken)),
|
|
710
728
|
environments: () => environments(makeCtx(resolveAdminToken)),
|
|
@@ -718,4 +736,4 @@ function createPlugin(options) {
|
|
|
718
736
|
*/
|
|
719
737
|
const AUTH_HINT = "generate fine-grained Personal Access Tokens at https://github.com/settings/tokens (one per feature — see docs/tokens.md for required scopes per operation), then run: holocron auth set github.<feature> <PAT>";
|
|
720
738
|
//#endregion
|
|
721
|
-
export { AUTH_HINT, AuthError, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubSecrets, GitHubSource, ci, createFeatureResolver, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveAdminToken, resolveDeployToken, resolveIssuesToken, resolveReadToken, resolveReleaseToken, resolveSyncToken, secrets, source, syncLabels, syncTeams, verifyToken };
|
|
739
|
+
export { AUTH_HINT, AuthError, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubSecrets, GitHubSource, ci, createFeatureResolver, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveAdminToken, resolveDeployToken, resolveIssuesToken, resolveOrgToken, resolveReadToken, resolveReleaseToken, resolveSyncToken, secrets, source, syncLabels, syncTeams, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-github",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Holocron plugin for GitHub. Implements source, ci, secrets, environments, and issues capabilities against the GitHub REST API.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/holocron/tree/main/packages/holocron-plugin-github#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/holocron/issues",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@theholocron/github-client": "^1.6.0",
|
|
26
|
-
"@theholocron/cli": "3.
|
|
26
|
+
"@theholocron/cli": "3.13.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"libsodium-wrappers": "^0.8.4"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tsx": "4.23.4",
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
46
|
"vitest": "^4.1.10",
|
|
47
|
-
"@theholocron/cli": "3.
|
|
47
|
+
"@theholocron/cli": "3.13.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|