@theholocron/astromech 5.1.1 → 5.1.2
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 +5 -40
- package/dist/index.mjs +169 -589
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -302,27 +302,13 @@ export declare const DOT_GITHUB_REPO = "theholocron/.github";
|
|
|
302
302
|
export declare const HOLOCRON_REPO = "theholocron/holocron";
|
|
303
303
|
/** How the templates spell a reference. Never emitted as it is, and never to be changed: {@link rehome} reads it. */
|
|
304
304
|
export declare const TEMPLATE_HOME: CiHome;
|
|
305
|
-
/**
|
|
306
|
-
* Whether a caller that calls its reusables at `home` keeps the names it had before they became the task id (the
|
|
307
|
-
* legacy-name gate): while 'home' is the frozen copies on `main`, the callers of a repo other than the one that hosts
|
|
308
|
-
* the reusables keep their old workflow, job and file names, because their rulesets list the checks those post. `ci-v1`
|
|
309
|
-
* has only flat names, so the gate is open there and every caller is flat (spec `ci-flat-task-vocabulary`, phase K).
|
|
310
|
-
*/
|
|
311
|
-
export declare function legacyGate(home?: CiHome): boolean;
|
|
312
305
|
/**
|
|
313
306
|
* `text` with every reference to a hosted reusable workflow at `home` rewritten to the file in the same checkout
|
|
314
|
-
* (`./.github/workflows/<name>.yml
|
|
307
|
+
* (`./.github/workflows/<name>.yml`). For the repo that serves the reusables: its own callers then run the reusable at
|
|
315
308
|
* their own commit, so a PR that edits one exercises it. Composite actions are left on their full ref, because a
|
|
316
309
|
* reusable called from another repository cannot see this checkout.
|
|
317
310
|
*/
|
|
318
311
|
export declare function localize(text: string, home?: CiHome): string;
|
|
319
|
-
/**
|
|
320
|
-
* `text` with each reference to a hosted composite action in `names` at `home` rewritten to its folder in the same
|
|
321
|
-
* checkout (`./ci/actions/<name>`). For the written copy of a reusable in the repo that hosts it, which only that
|
|
322
|
-
* repo's own callers run: a change to the action then takes effect at the PR's own commit, instead of waiting for
|
|
323
|
-
* the frozen copy in `theholocron/.github` that `home` still names. An action not in `names` keeps its full ref.
|
|
324
|
-
*/
|
|
325
|
-
export declare function localizeActions(text: string, names: readonly string[], home?: CiHome): string;
|
|
326
312
|
/**
|
|
327
313
|
* How strictly a repo enforces doc-comment coverage of its public API (`repoValidation.docsCoverage`, spec
|
|
328
314
|
* `tech-api-docs`): `off` (the default) does nothing, `warn` reports without failing and posts informational Codecov
|
|
@@ -1480,25 +1466,11 @@ export declare function isTask(name: string, id: string): boolean;
|
|
|
1480
1466
|
* old dotted names that are still accepted. What a config validator checks a `tasks:` entry against.
|
|
1481
1467
|
*/
|
|
1482
1468
|
export declare const KNOWN_TASKS: ReadonlySet<string>;
|
|
1483
|
-
/**
|
|
1484
|
-
* The thin caller `yaml` of task `id` spelled with the names it had before they became the task id: the old workflow
|
|
1485
|
-
* `name:` and the old id and `name:` of each job. This is the legacy-name gate (spec `ci-flat-task-vocabulary`, phase
|
|
1486
|
-
* F): a repo whose callers still call the frozen reusables in `theholocron/.github` keeps the checks its ruleset lists,
|
|
1487
|
-
* so only the repo that hosts the reusables (and, later, every repo once `CI_HOME` is `ci-v1`) gets the flat names.
|
|
1488
|
-
* An id with no old spelling is returned as it is. Only a job `name:` that is the id is rewritten, so a name a caller
|
|
1489
|
-
* builds itself (the grouped release's matrix name) is left to the entry's `replace`.
|
|
1490
|
-
*/
|
|
1491
|
-
export declare function legacyCaller(id: string, yaml: string): string;
|
|
1492
|
-
/**
|
|
1493
|
-
* The file name a thin caller of task `id` has while callers are legacy-named (see `legacyCaller`): the old task name
|
|
1494
|
-
* and `.yml`, `verification.unitTests.yml` for `test:unit`. An id with no old name (`preview`) keeps its own.
|
|
1495
|
-
*/
|
|
1496
|
-
export declare function legacyCallerFile(id: string): string;
|
|
1497
1469
|
/**
|
|
1498
1470
|
* The old file name of a flat reusable workflow — `test-unit.yml` is `verification.unitTests.yml`. The frozen copies in
|
|
1499
|
-
* `theholocron/.github` keep the old names and exist only there, so
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1471
|
+
* `theholocron/.github` keep the old names and exist only there, so the path of a frozen copy, and of a workflow that
|
|
1472
|
+
* is still dispatched there by name, is spelled with it (spec `ci-flat-task-vocabulary`). A file with no old name
|
|
1473
|
+
* (`preview.yml`, `ci.yml`) is returned as it is.
|
|
1502
1474
|
*/
|
|
1503
1475
|
export declare function legacyFile(file: string): string;
|
|
1504
1476
|
/**
|
|
@@ -1508,13 +1480,6 @@ export declare function legacyFile(file: string): string;
|
|
|
1508
1480
|
* `format` and the other formatting successors share the formatting workflow's name.
|
|
1509
1481
|
*/
|
|
1510
1482
|
export declare function legacyName(id: string): string | undefined;
|
|
1511
|
-
/**
|
|
1512
|
-
* The key of the workflow that carries `name` in a repo that still calls the frozen reusables in `theholocron/.github`
|
|
1513
|
-
* (the legacy-name gate): a flat id that shared an old workflow with others (`lint:markdown` and `format` with
|
|
1514
|
-
* `lint:editorconfig`, the old `sourceQuality.formatting`) maps to the first of them, because only that one has a
|
|
1515
|
-
* frozen reusable. Every other name is its own key, an old name mapping to its first successor.
|
|
1516
|
-
*/
|
|
1517
|
-
export declare function legacyWorkflowKey(name: string): string;
|
|
1518
1483
|
/**
|
|
1519
1484
|
* Script names npm and pnpm give a meaning of their own, so no task may be named like one (spec
|
|
1520
1485
|
* `ci-flat-task-vocabulary`, "npm lifecycle and package-manager names"): `pnpm publish` runs a script called `publish`
|
|
@@ -1562,7 +1527,7 @@ export declare function taskKey(name: string, id: string): string;
|
|
|
1562
1527
|
* the workflow that carries it. A flat id is its own key; an old name maps to the first id that replaced it
|
|
1563
1528
|
* (`sourceQuality.formatting` is `lint:editorconfig`); a task with no workflow of its own maps to the workflow that
|
|
1564
1529
|
* runs its check (`format` is `lint:code`, see `TaskDef.host`); a name with no old name (`preview`, an unknown one) is
|
|
1565
|
-
* its own key.
|
|
1530
|
+
* its own key.
|
|
1566
1531
|
*/
|
|
1567
1532
|
export declare function workflowKey(name: string): string;
|
|
1568
1533
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -352,6 +352,142 @@ function requiredChecksVerdict(input) {
|
|
|
352
352
|
...names
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
|
+
// src/generators/ci-ref/ci-ref.ts
|
|
356
|
+
/**
|
|
357
|
+
* The org slug a CLI user gets when no config names one. Where a resolved config is in reach, `config.org` is the
|
|
358
|
+
* source and this is only the fallback; a command with no config (`new repo`, `sync github`, `publish --sync-trust`)
|
|
359
|
+
* uses it as it is.
|
|
360
|
+
*/
|
|
361
|
+
const DEFAULT_ORG = "theholocron";
|
|
362
|
+
/** The `owner/repo` of the org's `.github` repo, which hosts the frozen reusable workflows (and Sentinel's dispatch target). */
|
|
363
|
+
const DOT_GITHUB_REPO = `${DEFAULT_ORG}/.github`;
|
|
364
|
+
/** The `owner/repo` of this monorepo, where the CLI, the reusables' sources and the Trusted Publisher config live. */
|
|
365
|
+
const HOLOCRON_REPO = `${DEFAULT_ORG}/holocron`;
|
|
366
|
+
/** How the templates spell a reference. Never emitted as it is, and never to be changed: {@link rehome} reads it. */
|
|
367
|
+
const TEMPLATE_HOME = {
|
|
368
|
+
workflows: `${DOT_GITHUB_REPO}/.github/workflows`,
|
|
369
|
+
actions: `${DOT_GITHUB_REPO}/.github/actions`,
|
|
370
|
+
ref: "main"
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Where the hosted files live and the tag generated callers pin them to: `theholocron/holocron` at `ci-v1`, the tag the
|
|
374
|
+
* first release of the `ci` group makes on the promoted `main`. Only flat names, and `ci.yml`, exist there. The repo
|
|
375
|
+
* that serves the files calls them by path instead ({@link localize}).
|
|
376
|
+
*/
|
|
377
|
+
const CI_TARGET = {
|
|
378
|
+
workflows: `${HOLOCRON_REPO}/.github/workflows`,
|
|
379
|
+
actions: `${HOLOCRON_REPO}/ci/actions`,
|
|
380
|
+
ref: "ci-v1"
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* Where generated workflows call the hosted files: {@link CI_TARGET}. It was {@link TEMPLATE_HOME}, the frozen copies in
|
|
384
|
+
* `theholocron/.github` at `main`, until the tag existed (spec `ci-flat-task-vocabulary`, phase K); moving the home is a
|
|
385
|
+
* change to this constant alone (spec `tech-workflows-in-holocron`, issue #1474).
|
|
386
|
+
*/
|
|
387
|
+
const CI_HOME = { ...CI_TARGET };
|
|
388
|
+
const REFERENCE = /theholocron\/\.github\/\.github\/(workflows|actions)\/([\w.-]+)@main/g;
|
|
389
|
+
/** `text` with every hosted-workflow and hosted-action reference moved from the templates' spelling to `home`. */
|
|
390
|
+
function rehome(text, home = CI_HOME) {
|
|
391
|
+
return text.replace(REFERENCE, (_all, kind, name) => `${home[kind]}/${name}@${home.ref}`);
|
|
392
|
+
}
|
|
393
|
+
/** {@link rehome} applied to every value of a map of templates. */
|
|
394
|
+
function rehomeAll(templates, home = CI_HOME) {
|
|
395
|
+
return Object.fromEntries(Object.entries(templates).map(([name, text]) => [name, rehome(text, home)]));
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* A `uses:` value for a hosted reusable workflow, for generated YAML that is not written in a template. `file` is the
|
|
399
|
+
* flat name (`deploy.yml`).
|
|
400
|
+
*/
|
|
401
|
+
function reusableWorkflowRef(file, home = CI_HOME) {
|
|
402
|
+
return `${home.workflows}/${file}@${home.ref}`;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* `text` with every reference to a hosted reusable workflow at `home` rewritten to the file in the same checkout
|
|
406
|
+
* (`./.github/workflows/<name>.yml`). For the repo that serves the reusables: its own callers then run the reusable at
|
|
407
|
+
* their own commit, so a PR that edits one exercises it. Composite actions are left on their full ref, because a
|
|
408
|
+
* reusable called from another repository cannot see this checkout.
|
|
409
|
+
*/
|
|
410
|
+
function localize(text, home = CI_HOME) {
|
|
411
|
+
const escaped = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
412
|
+
const reference = new RegExp(`${escaped(home.workflows)}/([\\w.-]+)@${escaped(home.ref)}`, "g");
|
|
413
|
+
return text.replace(reference, (_all, name) => `./.github/workflows/${name}`);
|
|
414
|
+
}
|
|
415
|
+
// src/generators/github-action-thin-callers/grouped-publish/yaml-scalar.ts
|
|
416
|
+
/**
|
|
417
|
+
* A value as a YAML scalar for a `with:` entry. Bare `[` and `{` would parse as
|
|
418
|
+
* sequence and mapping nodes, so values that start with one (JSON) are single-quoted
|
|
419
|
+
* and stay strings; a `'` inside is doubled, which is how YAML escapes it in single quotes.
|
|
420
|
+
*/
|
|
421
|
+
function yamlScalar(value) {
|
|
422
|
+
if (value === true) return "true";
|
|
423
|
+
if (value === false) return "false";
|
|
424
|
+
const text = String(value);
|
|
425
|
+
return text.startsWith("[") || text.startsWith("{") ? `'${text.replaceAll("'", "''")}'` : text;
|
|
426
|
+
}
|
|
427
|
+
// src/generators/github-action-thin-callers/workflow-title/workflow-title.ts
|
|
428
|
+
/** Words of a task id that are written in capitals, not title case. */
|
|
429
|
+
const ACRONYMS = {
|
|
430
|
+
ci: "CI",
|
|
431
|
+
dco: "DCO"
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* The title a task's runs carry in a run list: the id's words in title case (`deploy-sentinel` is `Deploy Sentinel`,
|
|
435
|
+
* `test:unit` is `Test Unit`, `ci` is `CI`). Only the run title uses it; the workflow, job and check names stay the id.
|
|
436
|
+
*/
|
|
437
|
+
function workflowTitle(id) {
|
|
438
|
+
return id.split(/[:-]/).filter(Boolean).map((word) => ACRONYMS[word] ?? word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
439
|
+
}
|
|
440
|
+
// src/generators/github-action-thin-callers/with-run-name/with-run-name.ts
|
|
441
|
+
/**
|
|
442
|
+
* Add a `run-name:` after the `name:` line of a thin caller, so a run is titled for what it did (`Deploy Sentinel
|
|
443
|
+
* (manual)`) and not with the task id. Only the events the caller has `triggers` for get a branch: a manual run says so,
|
|
444
|
+
* a scheduled one says so, a pull request run keeps the pull request title after the title, and any other event, a push
|
|
445
|
+
* included, is the title alone. A push run has no commit message in it: a squash commit's whole message, trailers
|
|
446
|
+
* included, would be the title, and an expression cannot cut it to its first line. The workflow `name:`, job names and
|
|
447
|
+
* so check names are not touched.
|
|
448
|
+
*/
|
|
449
|
+
function withRunName(yaml, id, triggers) {
|
|
450
|
+
if (/^run-name:/m.test(yaml)) return yaml;
|
|
451
|
+
const title = workflowTitle(id);
|
|
452
|
+
const branches = [];
|
|
453
|
+
if (triggers.includes("workflow_dispatch")) branches.push(`github.event_name == 'workflow_dispatch' && '${title} (manual)'`);
|
|
454
|
+
if (triggers.includes("schedule")) branches.push(`github.event_name == 'schedule' && '${title} (scheduled)'`);
|
|
455
|
+
if (triggers.some((t) => t === "pull_request" || t === "pull_request_target")) branches.push(`(github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('${title}: {0}', github.event.pull_request.title)`);
|
|
456
|
+
const value = branches.length === 0 ? title : `"\${{ ${[...branches, `'${title}'`].join(" || ")} }}"`;
|
|
457
|
+
return yaml.replace(/^(name: [^\n]*\n)/m, `$1\nrun-name: ${value}\n`);
|
|
458
|
+
}
|
|
459
|
+
// src/generators/aggregate-caller/aggregate-caller.ts
|
|
460
|
+
/**
|
|
461
|
+
* The thin caller of the `ci` aggregate: a `pull_request` workflow with one job, `ci`, that calls the reusable `ci.yml`
|
|
462
|
+
* with the ids to wait on. The job runs from the PR's own workflow file, so a PR that changes the ids is judged by them.
|
|
463
|
+
* It holds the permissions the reusable needs and nothing else; the reusable reads the Checks and status APIs only.
|
|
464
|
+
*/
|
|
465
|
+
function aggregateCaller({ expected, statuses }) {
|
|
466
|
+
return withRunName([
|
|
467
|
+
`name: ci`,
|
|
468
|
+
``,
|
|
469
|
+
`on: # yamllint disable-line rule:truthy`,
|
|
470
|
+
` pull_request:`,
|
|
471
|
+
``,
|
|
472
|
+
`concurrency:`,
|
|
473
|
+
` group: ci-\${{ github.ref }}`,
|
|
474
|
+
` cancel-in-progress: true`,
|
|
475
|
+
``,
|
|
476
|
+
`permissions:`,
|
|
477
|
+
` checks: read`,
|
|
478
|
+
` statuses: read`,
|
|
479
|
+
` contents: read`,
|
|
480
|
+
``,
|
|
481
|
+
`jobs:`,
|
|
482
|
+
` ci:`,
|
|
483
|
+
` name: ci`,
|
|
484
|
+
` uses: ${reusableWorkflowRef("ci.yml")}`,
|
|
485
|
+
` with:`,
|
|
486
|
+
` expected: ${yamlScalar(JSON.stringify(expected))}`,
|
|
487
|
+
` statuses: ${yamlScalar(JSON.stringify(statuses))}`,
|
|
488
|
+
``
|
|
489
|
+
].join("\n"), "ci", ["pull_request"]);
|
|
490
|
+
}
|
|
355
491
|
// src/vocabulary/suites/suites.ts
|
|
356
492
|
/**
|
|
357
493
|
* The suites the registry declares, in the order their first leaf appears: `test`, `lint`, `scan` and `validate`. A suite is declared by the `suite` field of its
|
|
@@ -402,7 +538,7 @@ var deploy_default$1 = "name: Deploy\n\non: # yamllint disable-line rule:truthy\
|
|
|
402
538
|
var doctor_tokens_default$1 = "name: Doctor Tokens\n\n# Runs `holocron doctor tokens` on a schedule (#2158, epic #2147): for each layer and each token a configured plugin\n# declares, it reads the layer's 1Password Environment in memory and runs the provider's `token` probe against the token\n# held there, so a token that gained a permission it must not have, lost one it needs, is past its rotation age or is near\n# its expiry fails this job. A failed run reaches #alerts through `platform.notifications.yml`; there is no other channel.\n#\n# Only what the runner can read is checked. The job reads Environments through a 1Password service account\n# (`HOLOCRON_OP_SERVICE_ACCOUNT_TOKEN`); it reads the `ci` Environment and nothing else, never `prod`. A layer the\n# account cannot read (`local`, `dev`) is a `skip` row with the reason, never a failure, so the run proves what CI\n# itself can reach and says what it did not look at. `doctor tokens` has no flag to limit the layers: a layer the account\n# can read is checked, and its fail rules are unchanged. Without the secret every row is a skip and the run passes, which\n# the job notes with a warning.\n#\n# Daily, a little after `check-tokens`, so a token near its expiry stays in view until it is renewed. Values are never\n# printed: the probes scrub every token they use from their output.\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_OP_SERVICE_ACCOUNT_TOKEN:\n description: A 1Password service account with read access to the `ci` layer Environment.\n required: false\n HOLOCRON_HEARTBEAT_DOCTOR_TOKENS:\n description: The ping URL of the `doctor-tokens` heartbeat. Without it the run sends none.\n required: false\n\njobs:\n doctor-tokens:\n name: Run holocron doctor tokens\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 15\n env:\n OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.HOLOCRON_OP_SERVICE_ACCOUNT_TOKEN }}\n # The Axiom probe names the dataset it reads; the workflows read each organization variable as HOLOCRON_X || X.\n HOLOCRON_AXIOM_DATASET: ${{ vars.HOLOCRON_AXIOM_DATASET || vars.AXIOM_DATASET }}\n steps:\n - name: Warn when no Environment can be read\n if: ${{ env.OP_SERVICE_ACCOUNT_TOKEN == '' }}\n run: echo \"::warning::HOLOCRON_OP_SERVICE_ACCOUNT_TOKEN is not set, so no Environment can be read and every row is a skip.\"\n\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n name: Checkout repository\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - uses: 1password/install-cli-action@1a3160d5e9de1ae0803eaa08a88746f5ae3daa50 # v4.1.0\n name: Install the 1Password CLI\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Run holocron doctor tokens\n with:\n task: doctor-tokens\n\n # Tells Checkly this run finished (#2359, the `doctor-tokens` heartbeat). Last, and only on success, so a red or\n # missing run is what Checkly notices. A no-op until the secret exists; the URL is a credential: it goes in through\n # `env` only, is masked, and a failed ping never fails the job.\n - name: Ping the heartbeat\n env:\n PING_URL: ${{ secrets.HOLOCRON_HEARTBEAT_DOCTOR_TOKENS }}\n run: |\n if [ -z \"$PING_URL\" ]; then\n echo \"::notice::HOLOCRON_HEARTBEAT_DOCTOR_TOKENS is not set, so no heartbeat was sent.\"\n exit 0\n fi\n echo \"::add-mask::$PING_URL\"\n curl -fsS --retry 3 --max-time 10 -o /dev/null \"$PING_URL\" || echo \"::warning::The heartbeat ping failed.\"\n";
|
|
403
539
|
var greet_default$1 = "name: Greetings\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n\njobs:\n greeting:\n name: Greet first-time contributors\n permissions:\n issues: write\n pull-requests: write\n runs-on: ubuntu-latest\n timeout-minutes: 5\n # Group by the issue/PR number so duplicate events don't race each other.\n steps:\n - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0\n name: Greet on first contribution\n with:\n script: |\n // Only greet on the initial open — ignore synchronize, reopened, etc.\n if (context.payload.action !== 'opened') return;\n\n const actor = context.actor;\n const { owner, repo } = context.repo;\n\n // Payload inspection is more reliable than context.eventName for detecting\n // whether this is an issue vs. PR event — works regardless of how GitHub\n // propagates event names through workflow_call chains.\n const isIssue = !!context.payload.issue && !context.payload.pull_request;\n // listForRepo returns both issues and PRs (GitHub treats PRs as issues),\n // sorted newest-first. Filter by type to track first-issue and first-PR\n // independently, and avoid search-index eventual-consistency lag.\n const { data: recent } = await github.rest.issues.listForRepo({\n owner, repo,\n creator: actor,\n state: 'all',\n per_page: 100\n });\n\n const sameType = recent.filter(item =>\n isIssue ? !item.pull_request : !!item.pull_request\n );\n\n if (sameType.length !== 1) return;\n const body = isIssue\n ? `Hey @${actor}!\\n\\nWe really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we are a limited number of volunteers, so it is possible that this will not be addressed as swiftly.\\n\\nYour patience is much appreciated and we will get back to you as quickly as possible.`\n : `Hey @${actor}!\\n\\nWe really appreciate you taking the time to help out with this PR. The collaborators on this project attempt to help as many people as possible, but we are a limited number of volunteers, so it is possible that this will not be addressed as swiftly.\\n\\nYour patience is much appreciated and we will get back to you as quickly as possible.`;\n\n await github.rest.issues.createComment({\n owner,\n repo,\n issue_number: context.issue.number,\n body\n });\n";
|
|
404
540
|
var label_default$1 = "name: Bookkeeping\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n inputs:\n configuration-path:\n description: Path to the labeler configuration file in the calling repo\n type: string\n required: false\n default: .github/labeler.yml\n\njobs:\n label:\n name: Apply Labels\n permissions:\n contents: read\n issues: write\n pull-requests: write\n runs-on: ubuntu-latest\n timeout-minutes: 5\n steps:\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n with:\n sparse-checkout: ${{ inputs.configuration-path || '.github/labeler.yml' }}\n sparse-checkout-cone-mode: false\n\n - uses: github/issue-labeler@ccca1e16fcb66762200e616fc29b57b940c1cb67 # v3.5\n if: ${{ github.event_name == 'pull_request' && hashFiles(inputs.configuration-path || '.github/labeler.yml') != '' }}\n # v3.4 bundles Node 20; allow it to run under Actions' current default.\n env:\n ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true\n with:\n # Fall back to default path when triggered directly (not via workflow_call)\n # because inputs.* defaults only apply on workflow_call events.\n configuration-path: ${{ inputs.configuration-path || '.github/labeler.yml' }}\n include-title: 1\n include-body: 0\n sync-labels: 1\n enable-versioned-regex: 0\n repo-token: ${{ github.token }}\n";
|
|
405
|
-
var code_default$1$1 = "name: Static Analysis\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_TURBO_TOKEN:\n description: The Turbo remote cache token. Read first; the TURBO_TOKEN secret is the fallback.\n required: false\n TURBO_TOKEN:\n required: false\n\njobs:\n static-analysis:\n name: Run eslint, actionlint and prettier\n permissions:\n contents: read\n statuses: write\n runs-on: ubuntu-latest\n timeout-minutes: 15\n env:\n TURBO_TOKEN: ${{ secrets.HOLOCRON_TURBO_TOKEN || secrets.TURBO_TOKEN }}\n TURBO_TEAM: ${{ vars.HOLOCRON_TURBO_TEAM || vars.TURBO_TEAM }}\n steps:\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n # actionlint has no npm distribution — install the prebuilt binary via\n # the maintainer's own documented download script.\n # NOTE: unverified against a live CI run at authoring time (D12) — flag\n # here if this needs adjustment.\n - name: Install actionlint\n run: |\n bash <(curl -sSf https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)\n sudo mv ./actionlint /usr/local/bin/actionlint\n\n - name: Check for merge-conflict markers\n # No package distributes this as a standalone tool — a plain grep for\n # the marker lines (the same check the old bundled linter ran, D12).\n run: |\n if grep -rlnE '^(<{7}|={7}|>{7})( |$)' \\\n --exclude-dir=.git --exclude-dir=node_modules .; then\n echo \"::error::merge-conflict markers found\"\n exit 1\n fi\n\n # Problem matchers turn the tools' own output into inline annotations on the pull request's diff (the job the\n # old `annotate` task did with ReviewDog, on a second checkout). They are files of this repo, so a copy of this\n # workflow that runs where they are missing skips them. `ci/matchers/eslint.json` reads stylish output, whose\n # paths are absolute, so turbo's `<package>:<task>:` prefix does not hide them.\n - name: Annotate eslint and actionlint findings\n run: |\n for matcher in eslint actionlint; do\n if [ -f \"ci/matchers/$matcher.json\" ]; then\n echo \"::add-matcher::ci/matchers/$matcher.json\"\n fi\n done\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Run eslint and actionlint\n with:\n task: lint:code\n\n # `holocron run lint:code` runs turbo, which runs each package's eslint and nothing else, so actionlint (installed\n # above) is run here, on the repo's workflows. It ran in the old `annotate` job; `!cancelled()` runs it even when\n # eslint failed, so one run shows both.\n - name: Run actionlint\n if: ${{ !cancelled() }}\n run: actionlint\n\n # prettier's check is the `format` action, not a workflow\n # of its own. It is called by
|
|
541
|
+
var code_default$1$1 = "name: Static Analysis\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_TURBO_TOKEN:\n description: The Turbo remote cache token. Read first; the TURBO_TOKEN secret is the fallback.\n required: false\n TURBO_TOKEN:\n required: false\n\njobs:\n static-analysis:\n name: Run eslint, actionlint and prettier\n permissions:\n contents: read\n statuses: write\n runs-on: ubuntu-latest\n timeout-minutes: 15\n env:\n TURBO_TOKEN: ${{ secrets.HOLOCRON_TURBO_TOKEN || secrets.TURBO_TOKEN }}\n TURBO_TEAM: ${{ vars.HOLOCRON_TURBO_TEAM || vars.TURBO_TEAM }}\n steps:\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n # actionlint has no npm distribution — install the prebuilt binary via\n # the maintainer's own documented download script.\n # NOTE: unverified against a live CI run at authoring time (D12) — flag\n # here if this needs adjustment.\n - name: Install actionlint\n run: |\n bash <(curl -sSf https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)\n sudo mv ./actionlint /usr/local/bin/actionlint\n\n - name: Check for merge-conflict markers\n # No package distributes this as a standalone tool — a plain grep for\n # the marker lines (the same check the old bundled linter ran, D12).\n run: |\n if grep -rlnE '^(<{7}|={7}|>{7})( |$)' \\\n --exclude-dir=.git --exclude-dir=node_modules .; then\n echo \"::error::merge-conflict markers found\"\n exit 1\n fi\n\n # Problem matchers turn the tools' own output into inline annotations on the pull request's diff (the job the\n # old `annotate` task did with ReviewDog, on a second checkout). They are files of this repo, so a copy of this\n # workflow that runs where they are missing skips them. `ci/matchers/eslint.json` reads stylish output, whose\n # paths are absolute, so turbo's `<package>:<task>:` prefix does not hide them.\n - name: Annotate eslint and actionlint findings\n run: |\n for matcher in eslint actionlint; do\n if [ -f \"ci/matchers/$matcher.json\" ]; then\n echo \"::add-matcher::ci/matchers/$matcher.json\"\n fi\n done\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Run eslint and actionlint\n with:\n task: lint:code\n\n # `holocron run lint:code` runs turbo, which runs each package's eslint and nothing else, so actionlint (installed\n # above) is run here, on the repo's workflows. It ran in the old `annotate` job; `!cancelled()` runs it even when\n # eslint failed, so one run shows both.\n - name: Run actionlint\n if: ${{ !cancelled() }}\n run: actionlint\n\n # prettier's check is the `format` action, not a workflow\n # of its own. It is called by the hosted reference, like the other actions; the repo that serves it runs its own\n # copy from the checkout (`./ci/actions/format`), see `hostedReusableWorkflows` in astromech.\n - uses: theholocron/.github/.github/actions/format@main\n name: Run prettier\n";
|
|
406
542
|
var commits_default$1 = "name: Commit Standards\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_TURBO_TOKEN:\n description: The Turbo remote cache token. Read first; the TURBO_TOKEN secret is the fallback.\n required: false\n TURBO_TOKEN:\n required: false\n\njobs:\n commit-standards:\n name: Run commitlint\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 10\n env:\n TURBO_TOKEN: ${{ secrets.HOLOCRON_TURBO_TOKEN || secrets.TURBO_TOKEN }}\n TURBO_TEAM: ${{ vars.HOLOCRON_TURBO_TEAM || vars.TURBO_TEAM }}\n steps:\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n # No local equivalent (linters.ts: commitlint has no localBin — enforced\n # only at commit time via the commit-msg hook, and here in CI over the\n # PR's commit range). Not run through the holocron composite action.\n #\n # --config <resolved shared path> (config-resolution workstream, #676)\n # — falls back to commitlint's own auto-discovery of a local\n # commitlint.config.ts when the shared package's built dist/ isn't\n # present, same guard as the commit-msg hook.\n - name: Run commitlint over the PR range\n if: github.event_name == 'pull_request'\n run: |\n COMMITLINT_CONFIG=\"node_modules/@theholocron/commitlint-config/dist/index.js\"\n if [ -f \"$COMMITLINT_CONFIG\" ]; then\n pnpm exec commitlint --config \"$COMMITLINT_CONFIG\" --from \"${{ github.event.pull_request.base.sha }}\" --to \"${{ github.sha }}\"\n else\n pnpm exec commitlint --from \"${{ github.event.pull_request.base.sha }}\" --to \"${{ github.sha }}\"\n fi\n";
|
|
407
543
|
var data_default$1 = "name: Structured Data Validation\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_TURBO_TOKEN:\n description: The Turbo remote cache token. Read first; the TURBO_TOKEN secret is the fallback.\n required: false\n TURBO_TOKEN:\n required: false\n\njobs:\n structured-data-validation:\n name: Run yamllint\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 10\n env:\n TURBO_TOKEN: ${{ secrets.HOLOCRON_TURBO_TOKEN || secrets.TURBO_TOKEN }}\n TURBO_TEAM: ${{ vars.HOLOCRON_TURBO_TEAM || vars.TURBO_TEAM }}\n steps:\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n name: Checkout repository\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n # yamllint has no npm distribution — Python ships preinstalled on\n # ubuntu-latest runners.\n - name: Install yamllint\n run: pip install --user yamllint\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Run yamllint\n with:\n task: lint:data\n";
|
|
408
544
|
var editorconfig_default$2 = "name: lint:editorconfig\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_TURBO_TOKEN:\n description: The Turbo remote cache token. Read first; the TURBO_TOKEN secret is the fallback.\n required: false\n TURBO_TOKEN:\n required: false\n\njobs:\n lint-editorconfig:\n name: Run editorconfig-checker\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 15\n env:\n TURBO_TOKEN: ${{ secrets.HOLOCRON_TURBO_TOKEN || secrets.TURBO_TOKEN }}\n TURBO_TEAM: ${{ vars.HOLOCRON_TURBO_TEAM || vars.TURBO_TEAM }}\n steps:\n - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n # editorconfig-checker has no npm distribution — install the prebuilt\n # binary from its release tarball (v4.0.1+ ships the binary at the\n # tarball root as `editorconfig-checker`, not `bin/ec-<os>-<arch>` —\n # confirmed against a live CI run; the old asset name/path 404s now).\n - name: Install editorconfig-checker\n run: |\n curl -sSL https://github.com/editorconfig-checker/editorconfig-checker/releases/latest/download/editorconfig-checker-linux-amd64.tar.gz \\\n | tar xz -C /usr/local/bin editorconfig-checker\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Run editorconfig-checker\n with:\n task: lint:editorconfig\n";
|
|
@@ -540,8 +676,8 @@ const ACTIONS = {
|
|
|
540
676
|
const BY_LEGACY_FILE = new Map(Object.entries(LEGACY_NAMES).flatMap(([legacy, targets]) => targets.slice(0, 1).map(({ id }) => [`${legacy}.yml`, workflowFile(id)])));
|
|
541
677
|
/**
|
|
542
678
|
* The flat file name of a reusable workflow given by its old one — `verification.unitTests.yml` is `test-unit.yml`.
|
|
543
|
-
* What a
|
|
544
|
-
*
|
|
679
|
+
* What a frozen copy in `theholocron/.github` is replaced by in `theholocron/holocron` (its deprecation notice names
|
|
680
|
+
* it). A file already flat, or with no old name, is returned as it is.
|
|
545
681
|
*/
|
|
546
682
|
function flatFile(file) {
|
|
547
683
|
return BY_LEGACY_FILE.get(file) ?? file;
|
|
@@ -556,432 +692,18 @@ const KNOWN_TASKS = /* @__PURE__ */ new Set([
|
|
|
556
692
|
...Object.keys(LEGACY_NAMES),
|
|
557
693
|
...Object.values(LEGACY_NAMES).flatMap((targets) => targets.map((target) => target.id))
|
|
558
694
|
]);
|
|
559
|
-
// src/vocabulary/legacy-callers/legacy-callers.ts
|
|
560
|
-
/**
|
|
561
|
-
* What each thin caller was called before the workflow, job and file names became the task id: the workflow `name:`,
|
|
562
|
-
* and the id and `name:` of each job by the id the job has now (the file basename, `workflowFile(id)` without `.yml`).
|
|
563
|
-
* A repo whose callers still point at the frozen reusables in `theholocron/.github` keeps these names, because its
|
|
564
|
-
* ruleset lists the checks they post (`<caller job name> / <called job name>`); see `legacyCaller`. Dropped with the
|
|
565
|
-
* gate when `CI_HOME` moves to `ci-v1`.
|
|
566
|
-
*/
|
|
567
|
-
const LEGACY_CALLERS = {
|
|
568
|
-
annotate: {
|
|
569
|
-
name: "Source Quality",
|
|
570
|
-
jobs: { annotate: {
|
|
571
|
-
id: "review",
|
|
572
|
-
name: "Annotations"
|
|
573
|
-
} }
|
|
574
|
-
},
|
|
575
|
-
build: {
|
|
576
|
-
name: "Delivery",
|
|
577
|
-
jobs: { build: {
|
|
578
|
-
id: "build",
|
|
579
|
-
name: "Build"
|
|
580
|
-
} }
|
|
581
|
-
},
|
|
582
|
-
"check-notify": {
|
|
583
|
-
name: "Platform",
|
|
584
|
-
jobs: { "check-notify": {
|
|
585
|
-
id: "notify-check",
|
|
586
|
-
name: "Notify Check"
|
|
587
|
-
} }
|
|
588
|
-
},
|
|
589
|
-
"check-preview": {
|
|
590
|
-
name: "Delivery",
|
|
591
|
-
jobs: { "check-preview": {
|
|
592
|
-
id: "preview-check",
|
|
593
|
-
name: "Preview Check"
|
|
594
|
-
} }
|
|
595
|
-
},
|
|
596
|
-
"check-tokens": {
|
|
597
|
-
name: "Token Expiry",
|
|
598
|
-
jobs: { "check-tokens": {
|
|
599
|
-
id: "token-expiry",
|
|
600
|
-
name: "Token Expiry"
|
|
601
|
-
} }
|
|
602
|
-
},
|
|
603
|
-
"doctor-tokens": {
|
|
604
|
-
name: "Doctor Tokens",
|
|
605
|
-
jobs: { "doctor-tokens": {
|
|
606
|
-
id: "doctor-tokens",
|
|
607
|
-
name: "Doctor Tokens"
|
|
608
|
-
} }
|
|
609
|
-
},
|
|
610
|
-
"deploy-preview": {
|
|
611
|
-
name: "Delivery",
|
|
612
|
-
jobs: { "deploy-preview": {
|
|
613
|
-
id: "preview-deploy",
|
|
614
|
-
name: "Preview Deploy"
|
|
615
|
-
} }
|
|
616
|
-
},
|
|
617
|
-
deploy: {
|
|
618
|
-
name: "Delivery",
|
|
619
|
-
combinedName: "Deploy",
|
|
620
|
-
jobs: {
|
|
621
|
-
deploy: {
|
|
622
|
-
id: "deploy",
|
|
623
|
-
name: "Deploy"
|
|
624
|
-
},
|
|
625
|
-
"deploy-preview": {
|
|
626
|
-
id: "preview",
|
|
627
|
-
name: "Preview"
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
},
|
|
631
|
-
greet: {
|
|
632
|
-
name: "Platform",
|
|
633
|
-
jobs: { greet: {
|
|
634
|
-
id: "greetings",
|
|
635
|
-
name: "Greetings"
|
|
636
|
-
} }
|
|
637
|
-
},
|
|
638
|
-
label: {
|
|
639
|
-
name: "Platform",
|
|
640
|
-
jobs: { label: {
|
|
641
|
-
id: "bookkeeping",
|
|
642
|
-
name: "Bookkeeping"
|
|
643
|
-
} }
|
|
644
|
-
},
|
|
645
|
-
"lint:code": {
|
|
646
|
-
name: "Source Quality",
|
|
647
|
-
jobs: { "lint-code": {
|
|
648
|
-
id: "static-analysis",
|
|
649
|
-
name: "Static Analysis"
|
|
650
|
-
} }
|
|
651
|
-
},
|
|
652
|
-
"lint:commits": {
|
|
653
|
-
name: "Platform",
|
|
654
|
-
jobs: { "lint-commits": {
|
|
655
|
-
id: "commit-standards",
|
|
656
|
-
name: "Commit Standards"
|
|
657
|
-
} }
|
|
658
|
-
},
|
|
659
|
-
"lint:data": {
|
|
660
|
-
name: "Source Quality",
|
|
661
|
-
jobs: { "lint-data": {
|
|
662
|
-
id: "structured-data-validation",
|
|
663
|
-
name: "Structured Data Validation"
|
|
664
|
-
} }
|
|
665
|
-
},
|
|
666
|
-
"lint:editorconfig": {
|
|
667
|
-
name: "Source Quality",
|
|
668
|
-
jobs: { "lint-editorconfig": {
|
|
669
|
-
id: "formatting",
|
|
670
|
-
name: "Formatting"
|
|
671
|
-
} }
|
|
672
|
-
},
|
|
673
|
-
"lint:markdown": {
|
|
674
|
-
name: "Source Quality",
|
|
675
|
-
jobs: { "lint-markdown": {
|
|
676
|
-
id: "formatting",
|
|
677
|
-
name: "Formatting"
|
|
678
|
-
} }
|
|
679
|
-
},
|
|
680
|
-
"lint:unused": {
|
|
681
|
-
name: "Source Quality",
|
|
682
|
-
jobs: { "lint-unused": {
|
|
683
|
-
id: "dead-code-analysis",
|
|
684
|
-
name: "Dead Code Analysis"
|
|
685
|
-
} }
|
|
686
|
-
},
|
|
687
|
-
"mark-stale": {
|
|
688
|
-
name: "Stale",
|
|
689
|
-
jobs: { "mark-stale": { id: "stale" } }
|
|
690
|
-
},
|
|
691
|
-
"measure:bundle": {
|
|
692
|
-
name: "Delivery",
|
|
693
|
-
jobs: { "measure-bundle": {
|
|
694
|
-
id: "bundle-size",
|
|
695
|
-
name: "Audit the Bundle Size"
|
|
696
|
-
} }
|
|
697
|
-
},
|
|
698
|
-
preview: {
|
|
699
|
-
name: "Preview",
|
|
700
|
-
jobs: { preview: {
|
|
701
|
-
id: "preview",
|
|
702
|
-
name: "Preview"
|
|
703
|
-
} }
|
|
704
|
-
},
|
|
705
|
-
"measure:docs": {
|
|
706
|
-
name: "Source Quality",
|
|
707
|
-
jobs: { "measure-docs": {
|
|
708
|
-
id: "docs-coverage",
|
|
709
|
-
name: "Docs coverage"
|
|
710
|
-
} }
|
|
711
|
-
},
|
|
712
|
-
"publish-wiki": {
|
|
713
|
-
name: "Knowledge",
|
|
714
|
-
jobs: {
|
|
715
|
-
"publish-wiki": {
|
|
716
|
-
id: "publish",
|
|
717
|
-
name: "Publish"
|
|
718
|
-
},
|
|
719
|
-
"publish-wiki-preview": {
|
|
720
|
-
id: "preview",
|
|
721
|
-
name: "Preview"
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
},
|
|
725
|
-
"remind-doctor": {
|
|
726
|
-
name: "Platform",
|
|
727
|
-
jobs: { "remind-doctor": {
|
|
728
|
-
id: "doctor-reminder",
|
|
729
|
-
name: "Doctor reminder"
|
|
730
|
-
} }
|
|
731
|
-
},
|
|
732
|
-
"reconcile-ci": {
|
|
733
|
-
name: "Reconcile ci",
|
|
734
|
-
jobs: { "reconcile-ci": {
|
|
735
|
-
id: "reconcile-ci",
|
|
736
|
-
name: "Reconcile ci"
|
|
737
|
-
} }
|
|
738
|
-
},
|
|
739
|
-
"reconcile-projects": {
|
|
740
|
-
name: "Platform",
|
|
741
|
-
jobs: { "reconcile-projects": {
|
|
742
|
-
id: "reconcile-projects",
|
|
743
|
-
name: "Reconcile Projects"
|
|
744
|
-
} }
|
|
745
|
-
},
|
|
746
|
-
release: {
|
|
747
|
-
name: "Delivery",
|
|
748
|
-
jobs: { release: {
|
|
749
|
-
id: "release",
|
|
750
|
-
name: "Release"
|
|
751
|
-
} },
|
|
752
|
-
replace: { "name: release ${{ matrix.group }}": "name: Release ${{ matrix.group }}" }
|
|
753
|
-
},
|
|
754
|
-
"scan:code": {
|
|
755
|
-
name: "Security",
|
|
756
|
-
jobs: { "scan-code": {
|
|
757
|
-
id: "security",
|
|
758
|
-
name: "Code Scanning"
|
|
759
|
-
} }
|
|
760
|
-
},
|
|
761
|
-
"scan:secrets": {
|
|
762
|
-
name: "Security",
|
|
763
|
-
jobs: { "scan-secrets": {
|
|
764
|
-
id: "secret-detection",
|
|
765
|
-
name: "Secret Detection"
|
|
766
|
-
} }
|
|
767
|
-
},
|
|
768
|
-
"sync-repo": {
|
|
769
|
-
name: "Platform",
|
|
770
|
-
jobs: { "sync-repo": {
|
|
771
|
-
id: "sync",
|
|
772
|
-
name: "Sync"
|
|
773
|
-
} }
|
|
774
|
-
},
|
|
775
|
-
"deploy-sentinel": {
|
|
776
|
-
name: "Sentinel Deploy",
|
|
777
|
-
jobs: { "deploy-sentinel": {
|
|
778
|
-
id: "deploy",
|
|
779
|
-
name: "Deploy"
|
|
780
|
-
} }
|
|
781
|
-
},
|
|
782
|
-
"sync-secrets": {
|
|
783
|
-
name: "Sentinel Secrets Sync",
|
|
784
|
-
jobs: { "sync-secrets": {
|
|
785
|
-
id: "sync",
|
|
786
|
-
name: "Sync"
|
|
787
|
-
} }
|
|
788
|
-
},
|
|
789
|
-
"sync-issues": {
|
|
790
|
-
name: "Sync Issues",
|
|
791
|
-
jobs: { "sync-issues": {
|
|
792
|
-
id: "sync-issues",
|
|
793
|
-
name: "Sync Issues"
|
|
794
|
-
} }
|
|
795
|
-
},
|
|
796
|
-
"sync-incidents": {
|
|
797
|
-
name: "Sync incidents",
|
|
798
|
-
jobs: { "sync-incidents": {
|
|
799
|
-
id: "sync-incidents",
|
|
800
|
-
name: "Sync incidents"
|
|
801
|
-
} }
|
|
802
|
-
},
|
|
803
|
-
"sync-prs": {
|
|
804
|
-
name: "Sync PRs",
|
|
805
|
-
jobs: { "sync-prs": {
|
|
806
|
-
id: "sync-prs",
|
|
807
|
-
name: "Sync PRs"
|
|
808
|
-
} }
|
|
809
|
-
},
|
|
810
|
-
"open-incident": {
|
|
811
|
-
name: "Open incident",
|
|
812
|
-
jobs: { "open-incident": {
|
|
813
|
-
id: "open-incident",
|
|
814
|
-
name: "Open incident"
|
|
815
|
-
} }
|
|
816
|
-
},
|
|
817
|
-
"sync-specs": {
|
|
818
|
-
name: "Spec discussions",
|
|
819
|
-
jobs: { "sync-specs": {
|
|
820
|
-
id: "sync",
|
|
821
|
-
name: "Sync"
|
|
822
|
-
} }
|
|
823
|
-
},
|
|
824
|
-
"preview-specs": {
|
|
825
|
-
name: "Spec discussions (pull request)",
|
|
826
|
-
jobs: { "preview-specs": {
|
|
827
|
-
id: "sync",
|
|
828
|
-
name: "Sync"
|
|
829
|
-
} }
|
|
830
|
-
},
|
|
831
|
-
"sync-templates": {
|
|
832
|
-
name: "Platform",
|
|
833
|
-
jobs: { "sync-templates": {
|
|
834
|
-
id: "sync-templates",
|
|
835
|
-
name: "Sync Templates"
|
|
836
|
-
} }
|
|
837
|
-
},
|
|
838
|
-
"test:perf": {
|
|
839
|
-
name: "Verification",
|
|
840
|
-
jobs: { "test-perf": {
|
|
841
|
-
id: "performance",
|
|
842
|
-
name: "Audit the Performance"
|
|
843
|
-
} }
|
|
844
|
-
},
|
|
845
|
-
"test:unit": {
|
|
846
|
-
name: "Verification",
|
|
847
|
-
jobs: { "test-unit": {
|
|
848
|
-
id: "test",
|
|
849
|
-
name: "Test"
|
|
850
|
-
} }
|
|
851
|
-
},
|
|
852
|
-
"test:visual": {
|
|
853
|
-
name: "Visual Regression",
|
|
854
|
-
jobs: { "test-visual": {
|
|
855
|
-
id: "visual-and-composition",
|
|
856
|
-
name: "Visual Regression"
|
|
857
|
-
} }
|
|
858
|
-
},
|
|
859
|
-
typecheck: {
|
|
860
|
-
name: "Verification",
|
|
861
|
-
jobs: { typecheck: {
|
|
862
|
-
id: "typecheck",
|
|
863
|
-
name: "Typecheck"
|
|
864
|
-
} }
|
|
865
|
-
},
|
|
866
|
-
"update-deps": {
|
|
867
|
-
name: "Platform",
|
|
868
|
-
jobs: { "update-deps": {
|
|
869
|
-
id: "dependencies",
|
|
870
|
-
name: "Dependencies"
|
|
871
|
-
} }
|
|
872
|
-
},
|
|
873
|
-
"validate:specs": {
|
|
874
|
-
name: "Platform",
|
|
875
|
-
jobs: { "validate-specs": {
|
|
876
|
-
id: "repo-validation",
|
|
877
|
-
name: "Repo Validation"
|
|
878
|
-
} }
|
|
879
|
-
},
|
|
880
|
-
"validate:docs": {
|
|
881
|
-
name: "Platform",
|
|
882
|
-
jobs: { "validate-docs": {
|
|
883
|
-
id: "repo-validation",
|
|
884
|
-
name: "Repo Validation"
|
|
885
|
-
} }
|
|
886
|
-
},
|
|
887
|
-
"validate:deps": {
|
|
888
|
-
name: "Source Quality",
|
|
889
|
-
jobs: { "validate-deps": {
|
|
890
|
-
id: "dependency-catalogs",
|
|
891
|
-
name: "Dependency catalogs"
|
|
892
|
-
} }
|
|
893
|
-
},
|
|
894
|
-
"validate:generated": {
|
|
895
|
-
name: "Source Quality",
|
|
896
|
-
jobs: { "validate-generated": {
|
|
897
|
-
id: "generated-files",
|
|
898
|
-
name: "Generated files"
|
|
899
|
-
} }
|
|
900
|
-
},
|
|
901
|
-
"deploy-docs": {
|
|
902
|
-
name: "Deploy",
|
|
903
|
-
jobs: {
|
|
904
|
-
"deploy-docs": {
|
|
905
|
-
id: "deploy",
|
|
906
|
-
name: "Deploy"
|
|
907
|
-
},
|
|
908
|
-
"deploy-docs-preview": {
|
|
909
|
-
id: "preview",
|
|
910
|
-
name: "Preview"
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
},
|
|
914
|
-
"deploy-components": {
|
|
915
|
-
name: "Deploy",
|
|
916
|
-
jobs: {
|
|
917
|
-
"deploy-components": {
|
|
918
|
-
id: "deploy",
|
|
919
|
-
name: "Deploy"
|
|
920
|
-
},
|
|
921
|
-
"deploy-components-preview": {
|
|
922
|
-
id: "preview",
|
|
923
|
-
name: "Preview"
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
// src/vocabulary/legacy-caller/legacy-caller.ts
|
|
929
|
-
const escaped = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
930
|
-
/**
|
|
931
|
-
* The thin caller `yaml` of task `id` spelled with the names it had before they became the task id: the old workflow
|
|
932
|
-
* `name:` and the old id and `name:` of each job. This is the legacy-name gate (spec `ci-flat-task-vocabulary`, phase
|
|
933
|
-
* F): a repo whose callers still call the frozen reusables in `theholocron/.github` keeps the checks its ruleset lists,
|
|
934
|
-
* so only the repo that hosts the reusables (and, later, every repo once `CI_HOME` is `ci-v1`) gets the flat names.
|
|
935
|
-
* An id with no old spelling is returned as it is. Only a job `name:` that is the id is rewritten, so a name a caller
|
|
936
|
-
* builds itself (the grouped release's matrix name) is left to the entry's `replace`.
|
|
937
|
-
*/
|
|
938
|
-
function legacyCaller(id, yaml) {
|
|
939
|
-
const legacy = LEGACY_CALLERS[id];
|
|
940
|
-
if (legacy === void 0) return yaml;
|
|
941
|
-
const combined = legacy.combinedName !== void 0 && /^ {2}[\w-]+-preview:\s*$/m.test(yaml);
|
|
942
|
-
let out = yaml.replace(/^name:.*$/m, `name: ${combined ? legacy.combinedName : legacy.name}`);
|
|
943
|
-
for (const [from, to] of Object.entries(legacy.replace ?? {})) out = out.replaceAll(from, to);
|
|
944
|
-
const flatName = new RegExp(`^ {4}name: ${escaped(id)}[^\\S\\n]*\\n`, "m");
|
|
945
|
-
for (const [flat, job] of Object.entries(legacy.jobs)) {
|
|
946
|
-
const block = new RegExp(`^ {2}${escaped(flat)}:[^\\S\\n]*\\n((?: {4}[^\\n]*\\n|\\n)*)`, "m");
|
|
947
|
-
out = out.replace(block, (_all, rest) => {
|
|
948
|
-
const body = rest.replace(flatName, job.name === void 0 ? "" : ` name: ${job.name}\n`);
|
|
949
|
-
return ` ${job.id}:\n${body}`;
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
return out;
|
|
953
|
-
}
|
|
954
|
-
// src/vocabulary/legacy-caller-file/legacy-caller-file.ts
|
|
955
|
-
/**
|
|
956
|
-
* The file name a thin caller of task `id` has while callers are legacy-named (see `legacyCaller`): the old task name
|
|
957
|
-
* and `.yml`, `verification.unitTests.yml` for `test:unit`. An id with no old name (`preview`) keeps its own.
|
|
958
|
-
*/
|
|
959
|
-
function legacyCallerFile(id) {
|
|
960
|
-
return `${legacyName(id) ?? id}.yml`;
|
|
961
|
-
}
|
|
962
695
|
// src/vocabulary/legacy-file/legacy-file.ts
|
|
963
696
|
/** Each flat reusable file name and the old file name it replaced: the file of the first successor of an old name. */
|
|
964
697
|
const BY_FLAT_FILE = new Map(Object.entries(LEGACY_NAMES).flatMap(([legacy, targets]) => targets.slice(0, 1).map(({ id }) => [workflowFile(id), `${legacy}.yml`])));
|
|
965
698
|
/**
|
|
966
699
|
* The old file name of a flat reusable workflow — `test-unit.yml` is `verification.unitTests.yml`. The frozen copies in
|
|
967
|
-
* `theholocron/.github` keep the old names and exist only there, so
|
|
968
|
-
*
|
|
969
|
-
*
|
|
700
|
+
* `theholocron/.github` keep the old names and exist only there, so the path of a frozen copy, and of a workflow that
|
|
701
|
+
* is still dispatched there by name, is spelled with it (spec `ci-flat-task-vocabulary`). A file with no old name
|
|
702
|
+
* (`preview.yml`, `ci.yml`) is returned as it is.
|
|
970
703
|
*/
|
|
971
704
|
function legacyFile(file) {
|
|
972
705
|
return BY_FLAT_FILE.get(file) ?? file;
|
|
973
706
|
}
|
|
974
|
-
// src/vocabulary/legacy-workflow-key/legacy-workflow-key.ts
|
|
975
|
-
/**
|
|
976
|
-
* The key of the workflow that carries `name` in a repo that still calls the frozen reusables in `theholocron/.github`
|
|
977
|
-
* (the legacy-name gate): a flat id that shared an old workflow with others (`lint:markdown` and `format` with
|
|
978
|
-
* `lint:editorconfig`, the old `sourceQuality.formatting`) maps to the first of them, because only that one has a
|
|
979
|
-
* frozen reusable. Every other name is its own key, an old name mapping to its first successor.
|
|
980
|
-
*/
|
|
981
|
-
function legacyWorkflowKey(name) {
|
|
982
|
-
const legacy = LEGACY_NAMES[name] ? name : legacyName(name);
|
|
983
|
-
return legacy === void 0 ? name : LEGACY_NAMES[legacy][0].id;
|
|
984
|
-
}
|
|
985
707
|
// src/vocabulary/reserved-script-names/reserved-script-names.ts
|
|
986
708
|
/**
|
|
987
709
|
* Script names npm and pnpm give a meaning of their own, so no task may be named like one (spec
|
|
@@ -1089,7 +811,7 @@ function taskKey(name, id) {
|
|
|
1089
811
|
* the workflow that carries it. A flat id is its own key; an old name maps to the first id that replaced it
|
|
1090
812
|
* (`sourceQuality.formatting` is `lint:editorconfig`); a task with no workflow of its own maps to the workflow that
|
|
1091
813
|
* runs its check (`format` is `lint:code`, see `TaskDef.host`); a name with no old name (`preview`, an unknown one) is
|
|
1092
|
-
* its own key.
|
|
814
|
+
* its own key.
|
|
1093
815
|
*/
|
|
1094
816
|
function workflowKey(name) {
|
|
1095
817
|
return LEGACY_NAMES[name]?.[0]?.id ?? TASKS[name]?.host ?? name;
|
|
@@ -1107,167 +829,6 @@ function workflowKeys(name) {
|
|
|
1107
829
|
const keys = [...new Set(ids.map(({ id }) => workflowKey(id)))];
|
|
1108
830
|
return keys.length > 0 ? keys : [workflowKey(name)];
|
|
1109
831
|
}
|
|
1110
|
-
// src/generators/ci-ref/ci-ref.ts
|
|
1111
|
-
/**
|
|
1112
|
-
* The org slug a CLI user gets when no config names one. Where a resolved config is in reach, `config.org` is the
|
|
1113
|
-
* source and this is only the fallback; a command with no config (`new repo`, `sync github`, `publish --sync-trust`)
|
|
1114
|
-
* uses it as it is.
|
|
1115
|
-
*/
|
|
1116
|
-
const DEFAULT_ORG = "theholocron";
|
|
1117
|
-
/** The `owner/repo` of the org's `.github` repo, which hosts the frozen reusable workflows (and Sentinel's dispatch target). */
|
|
1118
|
-
const DOT_GITHUB_REPO = `${DEFAULT_ORG}/.github`;
|
|
1119
|
-
/** The `owner/repo` of this monorepo, where the CLI, the reusables' sources and the Trusted Publisher config live. */
|
|
1120
|
-
const HOLOCRON_REPO = `${DEFAULT_ORG}/holocron`;
|
|
1121
|
-
/** How the templates spell a reference. Never emitted as it is, and never to be changed: {@link rehome} reads it. */
|
|
1122
|
-
const TEMPLATE_HOME = {
|
|
1123
|
-
workflows: `${DOT_GITHUB_REPO}/.github/workflows`,
|
|
1124
|
-
actions: `${DOT_GITHUB_REPO}/.github/actions`,
|
|
1125
|
-
ref: "main"
|
|
1126
|
-
};
|
|
1127
|
-
/**
|
|
1128
|
-
* Where generated workflows call the hosted files today. No change from the templates' own spelling until the files
|
|
1129
|
-
* move (#1475, #1480); the target is `theholocron/holocron/.github/workflows` and `theholocron/holocron/ci/actions` at
|
|
1130
|
-
* `ci-v1`.
|
|
1131
|
-
*/
|
|
1132
|
-
const CI_HOME = { ...TEMPLATE_HOME };
|
|
1133
|
-
/**
|
|
1134
|
-
* Where the hosted files will live once `ci-v1` exists, and where a frozen copy in `theholocron/.github` tells its
|
|
1135
|
-
* users to go. Not used to generate anything yet: {@link CI_HOME} follows when the tag does.
|
|
1136
|
-
*/
|
|
1137
|
-
const CI_TARGET = {
|
|
1138
|
-
workflows: `${HOLOCRON_REPO}/.github/workflows`,
|
|
1139
|
-
actions: `${HOLOCRON_REPO}/ci/actions`,
|
|
1140
|
-
ref: "ci-v1"
|
|
1141
|
-
};
|
|
1142
|
-
/**
|
|
1143
|
-
* The file name a reference to the reusable `file` (flat, as the templates spell it) has at `home`. The frozen copies
|
|
1144
|
-
* that `main` of `theholocron/.github` serves have the old names, so a `main` home gets the old name; `ci-v1` has only
|
|
1145
|
-
* flat ones.
|
|
1146
|
-
*/
|
|
1147
|
-
function fileAt(file, home) {
|
|
1148
|
-
return legacyGate(home) ? legacyFile(file) : file;
|
|
1149
|
-
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Whether a caller that calls its reusables at `home` keeps the names it had before they became the task id (the
|
|
1152
|
-
* legacy-name gate): while 'home' is the frozen copies on `main`, the callers of a repo other than the one that hosts
|
|
1153
|
-
* the reusables keep their old workflow, job and file names, because their rulesets list the checks those post. `ci-v1`
|
|
1154
|
-
* has only flat names, so the gate is open there and every caller is flat (spec `ci-flat-task-vocabulary`, phase K).
|
|
1155
|
-
*/
|
|
1156
|
-
function legacyGate(home = CI_HOME) {
|
|
1157
|
-
return home.ref === "main";
|
|
1158
|
-
}
|
|
1159
|
-
const REFERENCE = /theholocron\/\.github\/\.github\/(workflows|actions)\/([\w.-]+)@main/g;
|
|
1160
|
-
/** `text` with every hosted-workflow and hosted-action reference moved from the templates' spelling to `home`. */
|
|
1161
|
-
function rehome(text, home = CI_HOME) {
|
|
1162
|
-
return text.replace(REFERENCE, (_all, kind, name) => `${home[kind]}/${kind === "workflows" ? fileAt(name, home) : name}@${home.ref}`);
|
|
1163
|
-
}
|
|
1164
|
-
/** {@link rehome} applied to every value of a map of templates. */
|
|
1165
|
-
function rehomeAll(templates, home = CI_HOME) {
|
|
1166
|
-
return Object.fromEntries(Object.entries(templates).map(([name, text]) => [name, rehome(text, home)]));
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* A `uses:` value for a hosted reusable workflow, for generated YAML that is not written in a template. `file` is the
|
|
1170
|
-
* flat name (`deploy.yml`); at a `main` home it is spelled with the old one.
|
|
1171
|
-
*/
|
|
1172
|
-
function reusableWorkflowRef(file, home = CI_HOME) {
|
|
1173
|
-
return `${home.workflows}/${fileAt(file, home)}@${home.ref}`;
|
|
1174
|
-
}
|
|
1175
|
-
/**
|
|
1176
|
-
* `text` with every reference to a hosted reusable workflow at `home` rewritten to the file in the same checkout
|
|
1177
|
-
* (`./.github/workflows/<name>.yml`, always the flat name, whichever spelling the reference had). For the repo that hosts the reusables: its own callers then run the reusable at
|
|
1178
|
-
* their own commit, so a PR that edits one exercises it. Composite actions are left on their full ref, because a
|
|
1179
|
-
* reusable called from another repository cannot see this checkout.
|
|
1180
|
-
*/
|
|
1181
|
-
function localize(text, home = CI_HOME) {
|
|
1182
|
-
const escaped = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1183
|
-
const reference = new RegExp(`${escaped(home.workflows)}/([\\w.-]+)@${escaped(home.ref)}`, "g");
|
|
1184
|
-
return text.replace(reference, (_all, name) => `./.github/workflows/${flatFile(name)}`);
|
|
1185
|
-
}
|
|
1186
|
-
/**
|
|
1187
|
-
* `text` with each reference to a hosted composite action in `names` at `home` rewritten to its folder in the same
|
|
1188
|
-
* checkout (`./ci/actions/<name>`). For the written copy of a reusable in the repo that hosts it, which only that
|
|
1189
|
-
* repo's own callers run: a change to the action then takes effect at the PR's own commit, instead of waiting for
|
|
1190
|
-
* the frozen copy in `theholocron/.github` that `home` still names. An action not in `names` keeps its full ref.
|
|
1191
|
-
*/
|
|
1192
|
-
function localizeActions(text, names, home = CI_HOME) {
|
|
1193
|
-
return names.reduce((result, name) => result.replaceAll(`${home.actions}/${name}@${home.ref}`, `./ci/actions/${name}`), text);
|
|
1194
|
-
}
|
|
1195
|
-
// src/generators/github-action-thin-callers/grouped-publish/yaml-scalar.ts
|
|
1196
|
-
/**
|
|
1197
|
-
* A value as a YAML scalar for a `with:` entry. Bare `[` and `{` would parse as
|
|
1198
|
-
* sequence and mapping nodes, so values that start with one (JSON) are single-quoted
|
|
1199
|
-
* and stay strings; a `'` inside is doubled, which is how YAML escapes it in single quotes.
|
|
1200
|
-
*/
|
|
1201
|
-
function yamlScalar(value) {
|
|
1202
|
-
if (value === true) return "true";
|
|
1203
|
-
if (value === false) return "false";
|
|
1204
|
-
const text = String(value);
|
|
1205
|
-
return text.startsWith("[") || text.startsWith("{") ? `'${text.replaceAll("'", "''")}'` : text;
|
|
1206
|
-
}
|
|
1207
|
-
// src/generators/github-action-thin-callers/workflow-title/workflow-title.ts
|
|
1208
|
-
/** Words of a task id that are written in capitals, not title case. */
|
|
1209
|
-
const ACRONYMS = {
|
|
1210
|
-
ci: "CI",
|
|
1211
|
-
dco: "DCO"
|
|
1212
|
-
};
|
|
1213
|
-
/**
|
|
1214
|
-
* The title a task's runs carry in a run list: the id's words in title case (`deploy-sentinel` is `Deploy Sentinel`,
|
|
1215
|
-
* `test:unit` is `Test Unit`, `ci` is `CI`). Only the run title uses it; the workflow, job and check names stay the id.
|
|
1216
|
-
*/
|
|
1217
|
-
function workflowTitle(id) {
|
|
1218
|
-
return id.split(/[:-]/).filter(Boolean).map((word) => ACRONYMS[word] ?? word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1219
|
-
}
|
|
1220
|
-
// src/generators/github-action-thin-callers/with-run-name/with-run-name.ts
|
|
1221
|
-
/**
|
|
1222
|
-
* Add a `run-name:` after the `name:` line of a thin caller, so a run is titled for what it did (`Deploy Sentinel
|
|
1223
|
-
* (manual)`) and not with the task id. Only the events the caller has `triggers` for get a branch: a manual run says so,
|
|
1224
|
-
* a scheduled one says so, a pull request run keeps the pull request title after the title, and any other event, a push
|
|
1225
|
-
* included, is the title alone. A push run has no commit message in it: a squash commit's whole message, trailers
|
|
1226
|
-
* included, would be the title, and an expression cannot cut it to its first line. The workflow `name:`, job names and
|
|
1227
|
-
* so check names are not touched.
|
|
1228
|
-
*/
|
|
1229
|
-
function withRunName(yaml, id, triggers) {
|
|
1230
|
-
if (/^run-name:/m.test(yaml)) return yaml;
|
|
1231
|
-
const title = workflowTitle(id);
|
|
1232
|
-
const branches = [];
|
|
1233
|
-
if (triggers.includes("workflow_dispatch")) branches.push(`github.event_name == 'workflow_dispatch' && '${title} (manual)'`);
|
|
1234
|
-
if (triggers.includes("schedule")) branches.push(`github.event_name == 'schedule' && '${title} (scheduled)'`);
|
|
1235
|
-
if (triggers.some((t) => t === "pull_request" || t === "pull_request_target")) branches.push(`(github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && format('${title}: {0}', github.event.pull_request.title)`);
|
|
1236
|
-
const value = branches.length === 0 ? title : `"\${{ ${[...branches, `'${title}'`].join(" || ")} }}"`;
|
|
1237
|
-
return yaml.replace(/^(name: [^\n]*\n)/m, `$1\nrun-name: ${value}\n`);
|
|
1238
|
-
}
|
|
1239
|
-
// src/generators/aggregate-caller/aggregate-caller.ts
|
|
1240
|
-
/**
|
|
1241
|
-
* The thin caller of the `ci` aggregate: a `pull_request` workflow with one job, `ci`, that calls the reusable `ci.yml`
|
|
1242
|
-
* with the ids to wait on. The job runs from the PR's own workflow file, so a PR that changes the ids is judged by them.
|
|
1243
|
-
* It holds the permissions the reusable needs and nothing else; the reusable reads the Checks and status APIs only.
|
|
1244
|
-
*/
|
|
1245
|
-
function aggregateCaller({ expected, statuses }) {
|
|
1246
|
-
return withRunName([
|
|
1247
|
-
`name: ci`,
|
|
1248
|
-
``,
|
|
1249
|
-
`on: # yamllint disable-line rule:truthy`,
|
|
1250
|
-
` pull_request:`,
|
|
1251
|
-
``,
|
|
1252
|
-
`concurrency:`,
|
|
1253
|
-
` group: ci-\${{ github.ref }}`,
|
|
1254
|
-
` cancel-in-progress: true`,
|
|
1255
|
-
``,
|
|
1256
|
-
`permissions:`,
|
|
1257
|
-
` checks: read`,
|
|
1258
|
-
` statuses: read`,
|
|
1259
|
-
` contents: read`,
|
|
1260
|
-
``,
|
|
1261
|
-
`jobs:`,
|
|
1262
|
-
` ci:`,
|
|
1263
|
-
` name: ci`,
|
|
1264
|
-
` uses: ${reusableWorkflowRef("ci.yml")}`,
|
|
1265
|
-
` with:`,
|
|
1266
|
-
` expected: ${yamlScalar(JSON.stringify(expected))}`,
|
|
1267
|
-
` statuses: ${yamlScalar(JSON.stringify(statuses))}`,
|
|
1268
|
-
``
|
|
1269
|
-
].join("\n"), "ci", ["pull_request"]);
|
|
1270
|
-
}
|
|
1271
832
|
// src/templates/workflows/annotate.yml
|
|
1272
833
|
var annotate_default = "name: annotate\n\non: # yamllint disable-line rule:truthy\n pull_request:\n\nconcurrency:\n group: review-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n checks: write\n pull-requests: write\n\njobs:\n annotate:\n name: annotate\n uses: theholocron/.github/.github/workflows/annotate.yml@main\n secrets: inherit\n";
|
|
1273
834
|
// src/templates/workflows/build.yml
|
|
@@ -2070,6 +1631,27 @@ function readWorkspacePackages(repoRoot) {
|
|
|
2070
1631
|
};
|
|
2071
1632
|
}).sort((a, b) => packageLocation(a).localeCompare(packageLocation(b)));
|
|
2072
1633
|
}
|
|
1634
|
+
// src/generators/hosted-action-refs/hosted-action-refs.ts
|
|
1635
|
+
/**
|
|
1636
|
+
* The composite actions the repo that serves them runs from its own checkout, not from the frozen copy in
|
|
1637
|
+
* `theholocron/.github`: `format` exists only in `theholocron/holocron` (the frozen repo never got a copy), and
|
|
1638
|
+
* `codecov-upload` holds the upload loop, so a change to it (a retry) takes effect on the pull request that makes it
|
|
1639
|
+
* (#2124); the frozen copy never changes again.
|
|
1640
|
+
*/
|
|
1641
|
+
const LOCAL_ACTIONS = /* @__PURE__ */ new Set(["format", "codecov-upload"]);
|
|
1642
|
+
const escaped = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1643
|
+
/**
|
|
1644
|
+
* `text` (a reusable workflow already moved to `home`) with its composite-action references made resolvable in the repo
|
|
1645
|
+
* that serves the reusables, before `ci-v1` exists to resolve `theholocron/holocron/ci/actions/<name>@ci-v1`: a local action
|
|
1646
|
+
* is called by path from the checkout (`./ci/actions/format`), every other one keeps the frozen
|
|
1647
|
+
* copy in `theholocron/.github` at `main`, which is what it ran before the home moved. Only the copies this repo writes
|
|
1648
|
+
* to its own `.github/workflows` go through here; the reusables other repos call keep the `home` reference. Once the tag
|
|
1649
|
+
* exists the frozen spelling can go (the nested references inside `ci/actions` follow it).
|
|
1650
|
+
*/
|
|
1651
|
+
function hostedActionRefs(text, home = CI_HOME) {
|
|
1652
|
+
const reference = new RegExp(`${escaped(home.actions)}/([\\w.-]+)@${escaped(home.ref)}`, "g");
|
|
1653
|
+
return text.replace(reference, (_all, name) => LOCAL_ACTIONS.has(name) ? `./ci/actions/${name}` : `${TEMPLATE_HOME.actions}/${name}@${TEMPLATE_HOME.ref}`);
|
|
1654
|
+
}
|
|
2073
1655
|
// src/generators/github-action-reusable-workflows/github-action-reusable-workflows.ts
|
|
2074
1656
|
/**
|
|
2075
1657
|
* The **reusable** GitHub Actions surface pushed to `theholocron/.github` by
|
|
@@ -2099,7 +1681,7 @@ function hostedReusableWorkflows() {
|
|
|
2099
1681
|
return new Map(Object.entries(REUSABLE_WORKFLOWS).filter(([, text]) => {
|
|
2100
1682
|
const triggers = workflowTriggers(text);
|
|
2101
1683
|
return triggers.length === 1 && triggers[0] === "workflow_call";
|
|
2102
|
-
}));
|
|
1684
|
+
}).map(([id, text]) => [id, hostedActionRefs(text)]));
|
|
2103
1685
|
}
|
|
2104
1686
|
/**
|
|
2105
1687
|
* The path in `theholocron/.github` of the reusable workflow `id`: the old file name, because the frozen copies live
|
|
@@ -2111,7 +1693,7 @@ function remotePath(id) {
|
|
|
2111
1693
|
/** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
|
|
2112
1694
|
const REUSABLE_ACTIONS = rehomeAll(Object.fromEntries(Object.entries(ACTIONS).map(([name, text]) => [`${name}/action`, text])));
|
|
2113
1695
|
/** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
|
|
2114
|
-
const WORKFLOW_TEMPLATE_PROPERTIES = {
|
|
1696
|
+
const WORKFLOW_TEMPLATE_PROPERTIES = { label: JSON.stringify({
|
|
2115
1697
|
name: "Bookkeeping",
|
|
2116
1698
|
description: "Label and track issues and pull requests.",
|
|
2117
1699
|
iconName: "octicon tag"
|
|
@@ -2143,10 +1725,8 @@ function reusableTemplates() {
|
|
|
2143
1725
|
for (const [name, body] of Object.entries(REUSABLE_ACTIONS)) out.set(`.github/actions/${name}.yml`, `${header}${body}`);
|
|
2144
1726
|
for (const [id, body] of Object.entries(REUSABLE_WORKFLOWS)) out.set(remotePath(id), `${header}${body}`);
|
|
2145
1727
|
for (const [id, template] of Object.entries(WORKFLOW_TEMPLATES)) {
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
const body = legacyCaller(id, template);
|
|
2149
|
-
out.set(`workflow-templates/${name}.yml`, `${header}${body}`);
|
|
1728
|
+
const name = workflowFile(id).replace(/\.yml$/, "");
|
|
1729
|
+
out.set(`workflow-templates/${name}.yml`, `${header}${template}`);
|
|
2150
1730
|
const props = WORKFLOW_TEMPLATE_PROPERTIES[name];
|
|
2151
1731
|
if (props) out.set(`workflow-templates/${name}.properties.json`, props);
|
|
2152
1732
|
}
|
|
@@ -4677,4 +4257,4 @@ function createConfig$9() {
|
|
|
4677
4257
|
function createIgnoreConfig() {
|
|
4678
4258
|
return `${workflowHeader()}${_yamlignore_default}`;
|
|
4679
4259
|
}
|
|
4680
|
-
export { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, AGGREGATE_TIMEOUT_MS, CI_ORDER, DCO_CHECK, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, REUSABLE_ACTIONS, REUSABLE_WORKFLOWS, SUITES, TASKS, TEMPLATE_HOME, WORKFLOW_CHECK_CONTEXTS, WORKFLOW_TEMPLATES, WORKFLOW_TEMPLATE_PROPERTIES, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, codecovUploads, compareVersions, createAstromech, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createHeader, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createTsconfig, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, deriveDeployPaths, describeTasks, evaluateAggregate, extractPreviewConfig, formatJson, frozenReusablePaths, generateCombinedDeployContent, generateThinCallerContent, hostedReusableWorkflows, idFromSource, isDeprecated, isGeneratedScript, isTask,
|
|
4260
|
+
export { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, AGGREGATE_TIMEOUT_MS, CI_ORDER, DCO_CHECK, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, REUSABLE_ACTIONS, REUSABLE_WORKFLOWS, SUITES, TASKS, TEMPLATE_HOME, WORKFLOW_CHECK_CONTEXTS, WORKFLOW_TEMPLATES, WORKFLOW_TEMPLATE_PROPERTIES, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, codecovUploads, compareVersions, createAstromech, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createHeader, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createTsconfig, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, deriveDeployPaths, describeTasks, evaluateAggregate, extractPreviewConfig, formatJson, frozenReusablePaths, generateCombinedDeployContent, generateThinCallerContent, hostedReusableWorkflows, idFromSource, isDeprecated, isGeneratedScript, isTask, legacyFile, legacyName, localize, matchNamespace, mergeScripts, normalizeWorkflowWith, packageLocation, planSuites, planTasks, postAggregate, readWorkspacePackages, recordDeploys, requiredChecks, requiredChecksVerdict, resolveTaskName, reusableTemplates, runCi, runGroup, runTask, scriptName, scriptsFor, stampDeprecated, suiteMembers, taskKey, wedgeFix, workflowFile, workflowKey, workflowKeys, workspacePackages };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@commitlint/lint": "^21.3.0",
|
|
56
56
|
"@commitlint/load": "^21.3.0",
|
|
57
57
|
"@commitlint/types": "^21.3.0",
|
|
58
|
-
"@theholocron/datapad": "5.1.
|
|
58
|
+
"@theholocron/datapad": "5.1.2",
|
|
59
59
|
"@theholocron/fs-utils": "^2.0.0",
|
|
60
60
|
"@theholocron/json-utils": "^2.0.0",
|
|
61
61
|
"@theholocron/misc-utils": "^2.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"tsdown": "^0.23.7",
|
|
74
74
|
"typescript": "^6.0.3",
|
|
75
75
|
"vitest": "^5.1.2",
|
|
76
|
-
"@theholocron/ci": "1.0.
|
|
76
|
+
"@theholocron/ci": "1.0.2",
|
|
77
77
|
"@theholocron/commitlint-config": "^9.0.0",
|
|
78
78
|
"@theholocron/eslint-config": "^9.0.0",
|
|
79
79
|
"@theholocron/rollup-plugin-transform-template": "^9.0.0",
|