@theholocron/holocron-plugin-github 5.0.0-alpha.361 → 5.0.0-alpha.363
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 +2 -0
- package/dist/index.mjs +29 -0
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -279,6 +279,8 @@ export declare class GitHubSource implements Source {
|
|
|
279
279
|
writeRepoFile(path: string, contents: string): Promise<void>;
|
|
280
280
|
syncLabels(canonical: ReadonlyArray<LabelDef>, stale: ReadonlyArray<string>): Promise<string>;
|
|
281
281
|
syncProperties(values: Record<string, string | string[]>): Promise<string>;
|
|
282
|
+
getOrgPropertyValues(name: string): Promise<string[] | undefined>;
|
|
283
|
+
addOrgPropertyValues(name: string, values: string[]): Promise<string[]>;
|
|
282
284
|
checkPropertyValues(values: Record<string, string | string[]>): Promise<string[] | undefined>;
|
|
283
285
|
syncTeams(teams: TeamEntry$1[]): Promise<string>;
|
|
284
286
|
teamMembers(teamSlug: string, org?: string): Promise<SourceTeamMember[]>;
|
package/dist/index.mjs
CHANGED
|
@@ -1127,6 +1127,29 @@ async function syncProperties(client, repo, values, schemaClient = client) {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
return `${Object.keys(values).length} properties set`;
|
|
1129
1129
|
}
|
|
1130
|
+
/** The values the organization's property `name` allows; `undefined` when it cannot be read, is not defined or takes any value. */
|
|
1131
|
+
async function getOrgPropertyValues(client, repo, name) {
|
|
1132
|
+
return ((await orgSchema(client, repo))?.find((p) => p.property_name === name))?.allowed_values ?? void 0;
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Adds the missing `values` to the organization's property `name` and returns them. GitHub replaces the whole
|
|
1136
|
+
* definition on a write, so the current one is read and sent back with the allowed values extended, in their order,
|
|
1137
|
+
* and nothing removed. A write is made only when something is missing.
|
|
1138
|
+
*/
|
|
1139
|
+
async function addOrgPropertyValues(client, repo, name, values) {
|
|
1140
|
+
const org = repo.split("/")[0];
|
|
1141
|
+
const current = (await client.properties.orgSchema(org)).find((p) => p.property_name === name);
|
|
1142
|
+
if (!current) throw new Error(`the organization ${org} has no custom property "${name}"; create it first`);
|
|
1143
|
+
if (!current.allowed_values) throw new Error(`the custom property "${name}" takes any value; it has nothing to extend`);
|
|
1144
|
+
const have = new Set(current.allowed_values);
|
|
1145
|
+
const added = [...new Set(values)].filter((v) => !have.has(v));
|
|
1146
|
+
if (added.length === 0) return [];
|
|
1147
|
+
await client.properties.setOrgProperty(org, {
|
|
1148
|
+
...current,
|
|
1149
|
+
allowed_values: [...current.allowed_values, ...added]
|
|
1150
|
+
});
|
|
1151
|
+
return added;
|
|
1152
|
+
}
|
|
1130
1153
|
// src/capabilities/read-repo.ts
|
|
1131
1154
|
/** The settings `repo setup` writes, which `GET /repos/{repo}` reports under the same names. */
|
|
1132
1155
|
const SETTING_KEYS = [
|
|
@@ -1474,6 +1497,12 @@ var GitHubSource = class {
|
|
|
1474
1497
|
async syncProperties(values) {
|
|
1475
1498
|
return syncProperties(this.client, this.repo, values, this.orgClient ?? this.client);
|
|
1476
1499
|
}
|
|
1500
|
+
async getOrgPropertyValues(name) {
|
|
1501
|
+
return getOrgPropertyValues(this.orgClient ?? this.client, this.repo, name);
|
|
1502
|
+
}
|
|
1503
|
+
async addOrgPropertyValues(name, values) {
|
|
1504
|
+
return addOrgPropertyValues(this.orgClient ?? this.client, this.repo, name, values);
|
|
1505
|
+
}
|
|
1477
1506
|
async checkPropertyValues(values) {
|
|
1478
1507
|
return checkPropertyValues(this.orgClient ?? this.client, this.repo, values);
|
|
1479
1508
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-github",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.363",
|
|
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",
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
46
|
"vitest": "^5.0.5",
|
|
47
47
|
"@theholocron/eslint-config": "^8.9.0-alpha.9",
|
|
48
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
48
|
+
"@theholocron/cli": "5.0.0-alpha.363",
|
|
49
49
|
"@theholocron/fs-utils": "^1.17.0-alpha.1",
|
|
50
|
-
"@theholocron/github-client": "^1.58.0-alpha.
|
|
51
|
-
"@theholocron/http-client": "^1.58.0-alpha.14",
|
|
52
|
-
"@theholocron/tsconfig": "^8.9.0-alpha.9",
|
|
50
|
+
"@theholocron/github-client": "^1.58.0-alpha.15",
|
|
53
51
|
"@theholocron/misc-utils": "^1.17.0-alpha.1",
|
|
54
52
|
"@theholocron/tsdown-config": "^8.9.0-alpha.9",
|
|
53
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.9",
|
|
54
|
+
"@theholocron/http-client": "^1.58.0-alpha.15",
|
|
55
55
|
"@theholocron/vitest-config": "^8.9.0-alpha.9"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@theholocron/fs-utils": "^1.16.0",
|
|
59
59
|
"@theholocron/github-client": "^1.58.0",
|
|
60
60
|
"@theholocron/misc-utils": "^1.16.0",
|
|
61
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
61
|
+
"@theholocron/cli": "5.0.0-alpha.363"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22"
|