@theholocron/cli 5.0.0-alpha.209 → 5.0.0-alpha.210

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/README.md CHANGED
@@ -194,6 +194,7 @@ Additional `repo` fields recognised by `holocron repo setup`:
194
194
  | `repo.topics` | `string[]` | GitHub topics set on the repository. |
195
195
  | `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
196
196
  | `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
197
+ | `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on. |
197
198
 
198
199
  ### Custom properties synced to GitHub
199
200
 
package/dist/cli.mjs CHANGED
@@ -9023,6 +9023,58 @@ async function runSetup(input) {
9023
9023
  steps.push(await runStep("source", "sync topics", dryRun, () => source.syncTopics(topics)));
9024
9024
  print(formatStep(steps[steps.length - 1]));
9025
9025
  }
9026
+ const variables = repo?.variables;
9027
+ const prune = variables?.prune === true;
9028
+ const declares = (scope) => scope !== void 0 && (Object.keys(scope).length > 0 || prune);
9029
+ const variableStep = async (step, body) => {
9030
+ const result = await runStep("source", step, false, () => body(dryRun));
9031
+ return dryRun && result.status === "ok" ? {
9032
+ ...result,
9033
+ status: "dry-run"
9034
+ } : result;
9035
+ };
9036
+ if (declares(variables?.repo)) {
9037
+ if (!source.syncVariables) steps.push({
9038
+ capability: "source",
9039
+ step: "sync variables",
9040
+ status: "skip",
9041
+ message: "provider does not implement syncVariables"
9042
+ });
9043
+ else steps.push(await variableStep("sync variables", (dry) => source.syncVariables(variables.repo, {
9044
+ prune,
9045
+ dryRun: dry
9046
+ })));
9047
+ print(formatStep(steps[steps.length - 1]));
9048
+ }
9049
+ if (declares(variables?.org)) {
9050
+ const org = config.org ?? (input.context.repo ?? repo?.name ?? "").split("/")[0];
9051
+ if (!source.syncOrgVariables) steps.push({
9052
+ capability: "source",
9053
+ step: "sync org variables",
9054
+ status: "skip",
9055
+ message: "provider does not implement syncOrgVariables"
9056
+ });
9057
+ else if (!org) steps.push({
9058
+ capability: "source",
9059
+ step: "sync org variables",
9060
+ status: "fail",
9061
+ message: "no organization: set `org` in the config or run inside a repository"
9062
+ });
9063
+ else {
9064
+ const declared = Object.fromEntries(Object.entries(variables.org).map(([name, v]) => [name, typeof v === "string" ? {
9065
+ value: v,
9066
+ visibility: "all"
9067
+ } : {
9068
+ value: v.value,
9069
+ visibility: v.visibility ?? "all"
9070
+ }]));
9071
+ steps.push(await variableStep("sync org variables", (dry) => source.syncOrgVariables(org, declared, {
9072
+ prune,
9073
+ dryRun: dry
9074
+ })));
9075
+ }
9076
+ print(formatStep(steps[steps.length - 1]));
9077
+ }
9026
9078
  if (config.description && source.syncDescription) {
9027
9079
  steps.push(await runStep("source", "sync description", dryRun, () => source.syncDescription(config.description)));
9028
9080
  print(formatStep(steps[steps.length - 1]));