From 8d43ddb2deb145f6ba2b2001b5d4cfc785a5d1f6 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 08:59:15 -0600 Subject: [PATCH 01/30] chore: add @actions/core to interface with GitHub Actions --- deno.jsonc | 8 ++++---- deno.lock | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index d26610f..70f3dfa 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -8,9 +8,7 @@ }, "imports": { - // Import alias - "@root/": "./", - // External dependencies + "@actions/core": "npm:@actions/core@^1.11.1", "@biomejs/biome": "npm:@biomejs/biome@2.3.6", "@std/assert": "jsr:@std/assert@1.0.16", "@std/testing": "jsr:@std/testing@1.0.16", @@ -18,7 +16,9 @@ "@std/cli": "jsr:@std/cli@1.0.24", "@std/fs": "jsr:@std/fs@1.0.20", "@std/path": "jsr:@std/path@1.1.3", - "chevrotain": "npm:chevrotain@^11.0.3" + "chevrotain": "npm:chevrotain@^11.0.3", + + "@root/": "./" }, "test": { diff --git a/deno.lock b/deno.lock index 3bd68b1..f407e94 100644 --- a/deno.lock +++ b/deno.lock @@ -13,6 +13,7 @@ "jsr:@std/path@^1.1.2": "1.1.3", "jsr:@std/path@^1.1.3": "1.1.3", "jsr:@std/testing@1.0.16": "1.0.16", + "npm:@actions/core@^1.11.1": "1.11.1", "npm:@biomejs/biome@2.3.6": "2.3.6", "npm:@types/node@*": "24.2.0", "npm:chevrotain@^11.0.3": "11.0.3" @@ -67,6 +68,29 @@ } }, "npm": { + "@actions/core@1.11.1": { + "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", + "dependencies": [ + "@actions/exec", + "@actions/http-client" + ] + }, + "@actions/exec@1.1.1": { + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", + "dependencies": [ + "@actions/io" + ] + }, + "@actions/http-client@2.2.3": { + "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", + "dependencies": [ + "tunnel", + "undici" + ] + }, + "@actions/io@1.1.3": { + "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==" + }, "@biomejs/biome@2.3.6": { "integrity": "sha512-oqUhWyU6tae0MFsr/7iLe++QWRg+6jtUhlx9/0GmCWDYFFrK366sBLamNM7D9Y+c7YSynUFKr8lpEp1r6Sk7eA==", "optionalDependencies": [ @@ -145,6 +169,9 @@ "@chevrotain/utils@11.0.3": { "integrity": "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==" }, + "@fastify/busboy@2.1.1": { + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==" + }, "@types/node@24.2.0": { "integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==", "dependencies": [ @@ -165,8 +192,17 @@ "lodash-es@4.17.21": { "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, + "tunnel@0.0.6": { + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + }, "undici-types@7.10.0": { "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==" + }, + "undici@5.29.0": { + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", + "dependencies": [ + "@fastify/busboy" + ] } }, "workspace": { @@ -177,6 +213,7 @@ "jsr:@std/fs@1.0.20", "jsr:@std/path@1.1.3", "jsr:@std/testing@1.0.16", + "npm:@actions/core@^1.11.1", "npm:@biomejs/biome@2.3.6", "npm:chevrotain@^11.0.3" ] From a354a7c2cc74a3b2446c49d6ea41f82fceb1a859 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:48:40 -0600 Subject: [PATCH 02/30] feat(infra/actions): add initial deno script --- scripts/ci/deno.jsonc | 14 ++++++++++++++ scripts/ci/main.ts | 17 +++++++++++++++++ scripts/ci/mod.ts | 0 3 files changed, 31 insertions(+) create mode 100644 scripts/ci/deno.jsonc create mode 100644 scripts/ci/main.ts create mode 100644 scripts/ci/mod.ts diff --git a/scripts/ci/deno.jsonc b/scripts/ci/deno.jsonc new file mode 100644 index 0000000..518bbf0 --- /dev/null +++ b/scripts/ci/deno.jsonc @@ -0,0 +1,14 @@ +{ + "name": "@encode/ci", + "version": "0.1.0", + + "exports": { + ".": "./main.ts", + + "./lib": "./mod.ts" + }, + + "imports": { + "@/": "./" + } +} diff --git a/scripts/ci/main.ts b/scripts/ci/main.ts new file mode 100644 index 0000000..16d5530 --- /dev/null +++ b/scripts/ci/main.ts @@ -0,0 +1,17 @@ +import { notice } from '@actions/core'; +import { bold } from '@std/fmt/colors'; + +export function main(): void { + const msg = `This is a test run. ${bold('Everything is working ok!')}`; + + notice(msg, { + title: 'Test run', + file: import.meta.filename, + startLine: 5, + endLine: 12, + }); +} + +if (import.meta.main) { + main(); +} diff --git a/scripts/ci/mod.ts b/scripts/ci/mod.ts new file mode 100644 index 0000000..e69de29 From 7bc40f6bae6a6833510fc6cd9496759036a5f205 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:57:55 -0600 Subject: [PATCH 03/30] ci(infra/actions): add deno CI test run action --- .github/workflows/deno-ci-test-run.yml | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/deno-ci-test-run.yml diff --git a/.github/workflows/deno-ci-test-run.yml b/.github/workflows/deno-ci-test-run.yml new file mode 100644 index 0000000..00f54ea --- /dev/null +++ b/.github/workflows/deno-ci-test-run.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + pull_request: + +env: + # Used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed + CACHE_KEY_BASE: deno-ci@v1 + +jobs: + deno-job: + name: Run Deno test run job + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Deno + uses: denoland/setup-deno@v2 + with: + deno-version: 2.x + cache-hash: ${{ env.CACHE_KEY_BASE }}-${{ hashFiles('deno.lock') }} + + - name: Install dependencies + run: deno install + + - name: Run test run script + run: deno run --allow-env @encode/ci From f5bb9acc9b02d79db12849a6b87d0c5fc719dc50 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:59:10 -0600 Subject: [PATCH 04/30] ci: ensure test run ci only runs in the current branch --- .github/workflows/deno-ci-test-run.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deno-ci-test-run.yml b/.github/workflows/deno-ci-test-run.yml index 00f54ea..f7ac965 100644 --- a/.github/workflows/deno-ci-test-run.yml +++ b/.github/workflows/deno-ci-test-run.yml @@ -1,8 +1,9 @@ -name: CI +name: Deno CI (test run) on: push: - pull_request: + branches: + - infra/actions/denoize env: # Used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed @@ -24,6 +25,6 @@ jobs: - name: Install dependencies run: deno install - + - name: Run test run script run: deno run --allow-env @encode/ci From 01ac706e86f62a2ac96d9d237b24e3a9679d9744 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 16:05:45 -0600 Subject: [PATCH 05/30] refactor(infra/actions): try CI detection --- scripts/ci/main.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/ci/main.ts b/scripts/ci/main.ts index 16d5530..d8e2690 100644 --- a/scripts/ci/main.ts +++ b/scripts/ci/main.ts @@ -1,17 +1,14 @@ import { notice } from '@actions/core'; import { bold } from '@std/fmt/colors'; -export function main(): void { - const msg = `This is a test run. ${bold('Everything is working ok!')}`; +export async function main(): Promise { + if (Deno.env.get('CI')) { + console.log("We're in a CI environment!"); + } - notice(msg, { - title: 'Test run', - file: import.meta.filename, - startLine: 5, - endLine: 12, - }); + console.log(`We are ${bold('not')} in a CI environment!`); } if (import.meta.main) { - main(); + await main(); } From 2464c9fd19b94f3377e1cc37d67e4a2afb180ab7 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 16:09:41 -0600 Subject: [PATCH 06/30] refactor(infra/actions): fix CI detection to actually choose a branch, and also inspect the CI variable --- scripts/ci/main.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/ci/main.ts b/scripts/ci/main.ts index d8e2690..1e0db83 100644 --- a/scripts/ci/main.ts +++ b/scripts/ci/main.ts @@ -2,11 +2,13 @@ import { notice } from '@actions/core'; import { bold } from '@std/fmt/colors'; export async function main(): Promise { - if (Deno.env.get('CI')) { - console.log("We're in a CI environment!"); - } + const ci = Deno.env.get('CI'); - console.log(`We are ${bold('not')} in a CI environment!`); + if (ci) { + console.log("We're in a CI environment!", { ci }); + } else { + console.log(`We are ${bold('not')} in a CI environment!`); + } } if (import.meta.main) { From f11e03335ae4badf93ad5ba447176c42aad6b683 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:08:43 -0600 Subject: [PATCH 07/30] feat(scripts/ci): add new workflow API --- scripts/ci/src/core.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 scripts/ci/src/core.ts diff --git a/scripts/ci/src/core.ts b/scripts/ci/src/core.ts new file mode 100644 index 0000000..f3820bf --- /dev/null +++ b/scripts/ci/src/core.ts @@ -0,0 +1,8 @@ +export type Task = () => void | Promise; + +export interface Step { + id: string; + run: Task; + postRun: Task; +} + From 25684c452c9038f34d43ce4efe035d9afded183a Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:32:27 -0600 Subject: [PATCH 08/30] chore(config/deno): add ci permission set --- deno.jsonc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deno.jsonc b/deno.jsonc index 70f3dfa..29a1b95 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -31,6 +31,11 @@ "biome": { "env": true, "run": true + }, + + "ci": { + "env": true, + "run": ["deno"] } }, From 89071efd7aff287c52717fd105a35e65908019bd Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:33:23 -0600 Subject: [PATCH 09/30] chore(deps): update lockfile --- deno.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/deno.lock b/deno.lock index f407e94..c049c54 100644 --- a/deno.lock +++ b/deno.lock @@ -14,6 +14,7 @@ "jsr:@std/path@^1.1.3": "1.1.3", "jsr:@std/testing@1.0.16": "1.0.16", "npm:@actions/core@^1.11.1": "1.11.1", + "npm:@biomejs/biome@*": "2.3.6", "npm:@biomejs/biome@2.3.6": "2.3.6", "npm:@types/node@*": "24.2.0", "npm:chevrotain@^11.0.3": "11.0.3" From b555045f02985be1143ee1d024e5901241411bce Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:42:57 -0600 Subject: [PATCH 10/30] Revert "feat(scripts/ci): add new workflow API" This reverts commit f11e03335ae4badf93ad5ba447176c42aad6b683. --- scripts/ci/src/core.ts | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 scripts/ci/src/core.ts diff --git a/scripts/ci/src/core.ts b/scripts/ci/src/core.ts deleted file mode 100644 index f3820bf..0000000 --- a/scripts/ci/src/core.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type Task = () => void | Promise; - -export interface Step { - id: string; - run: Task; - postRun: Task; -} - From c7df4e9991191da82c7c7d944f49af5ba6a7d8dc Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 01:06:33 -0600 Subject: [PATCH 11/30] feat(scripts/ci): achieve near-feature-parity with original CI workflow --- scripts/ci/main.ts | 45 +++++++++++++++++++++++++++++-------- scripts/ci/mod.ts | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 9 deletions(-) diff --git a/scripts/ci/main.ts b/scripts/ci/main.ts index 1e0db83..15fafdf 100644 --- a/scripts/ci/main.ts +++ b/scripts/ci/main.ts @@ -1,14 +1,41 @@ -import { notice } from '@actions/core'; -import { bold } from '@std/fmt/colors'; +import { permissionArgs, runCommands } from '@encode/ci/lib'; export async function main(): Promise { - const ci = Deno.env.get('CI'); - - if (ci) { - console.log("We're in a CI environment!", { ci }); - } else { - console.log(`We are ${bold('not')} in a CI environment!`); - } + await runCommands([ + { + name: 'Biome checks', + args: [ + Deno.execPath(), + { + args: ['run', ...permissionArgs('biome'), 'npm:@biomejs/biome', 'ci'], + stderr: 'piped', + stdout: 'piped', + }, + ], + }, + { + name: 'Deno checks', + args: [ + Deno.execPath(), + { + args: ['check'], + stderr: 'piped', + stdout: 'piped', + }, + ], + }, + { + name: 'Tests', + args: [ + Deno.execPath(), + { + args: ['test', ...permissionArgs(), '--coverage', '--shuffle'], + stderr: 'piped', + stdout: 'piped', + }, + ], + }, + ]); } if (import.meta.main) { diff --git a/scripts/ci/mod.ts b/scripts/ci/mod.ts index e69de29..c79b471 100644 --- a/scripts/ci/mod.ts +++ b/scripts/ci/mod.ts @@ -0,0 +1,55 @@ +import { error } from '@actions/core'; +import { bold, red } from '@std/fmt/colors'; + +export interface CommandParams { + name: string; + args: ConstructorParameters; +} + +export async function runCommands( + commandParams: Iterable, +): Promise { + const processes = Array.from(commandParams, ({ name, args }) => { + return { name, process: new Deno.Command(...args).spawn() }; + }); + + for (const [idx, { name, process }] of processes.entries()) { + await Promise.all([ + process.stderr.pipeTo(Deno.stderr.writable, { preventClose: true, preventAbort: true }), + process.stdout.pipeTo(Deno.stdout.writable, { preventClose: true, preventAbort: true }), + ]); + + if (!(await process.status).success) { + console.log('\n'); + + annotateError({ title: 'CI', message: `${name} failed!` }); + } + + if (idx !== processes.length - 1) { + console.log(`\n${bold('-'.repeat(Deno.consoleSize().columns))}\n\n`); + } + } +} + +export function isCI() { + return Deno.env.get('CI') === 'true'; +} + +export function permissionArgs(permissionSetName?: string): string[] { + return [permissionSetName ? `-P=${permissionSetName}` : '-P', '--no-prompt']; +} + +interface Annotation { + title: string; + message: string; +} + +function annotateError(annotation: Annotation): void { + const { title, message } = annotation; + + if (isCI()) { + error(red(message), { title }); + } else { + console.error(`${bold(`${title}:`)} ${red(message)}`); + } +} From 5abba810c9319ce57f1e8d63bb161532bbd66295 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 01:09:01 -0600 Subject: [PATCH 12/30] ci(scripts/ci): ensure script is run with correct permissions --- .github/workflows/deno-ci-test-run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deno-ci-test-run.yml b/.github/workflows/deno-ci-test-run.yml index f7ac965..6b30296 100644 --- a/.github/workflows/deno-ci-test-run.yml +++ b/.github/workflows/deno-ci-test-run.yml @@ -27,4 +27,4 @@ jobs: run: deno install - name: Run test run script - run: deno run --allow-env @encode/ci + run: deno run -P=ci @encode/ci From 1f4ed588aea9a0a72ad1df3a26fdc76ef67ec115 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 01:12:16 -0600 Subject: [PATCH 13/30] fix(scripts/ci): ensure width is always calculated, even in CI --- scripts/ci/mod.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/ci/mod.ts b/scripts/ci/mod.ts index c79b471..12cc8e9 100644 --- a/scripts/ci/mod.ts +++ b/scripts/ci/mod.ts @@ -26,7 +26,15 @@ export async function runCommands( } if (idx !== processes.length - 1) { - console.log(`\n${bold('-'.repeat(Deno.consoleSize().columns))}\n\n`); + const width = (() => { + try { + return Deno.consoleSize().columns; + } catch { + return 10; + } + })(); + + console.log(`\n${bold('-'.repeat(width))}\n\n`); } } } From db1bcf0a2ed5a4aa82b4781b85ada8d3512dc4de Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:03:10 -0600 Subject: [PATCH 14/30] refactor(scripts/ci): move common command options to one dedicated object --- scripts/ci/main.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/ci/main.ts b/scripts/ci/main.ts index 15fafdf..564187f 100644 --- a/scripts/ci/main.ts +++ b/scripts/ci/main.ts @@ -1,15 +1,19 @@ import { permissionArgs, runCommands } from '@encode/ci/lib'; export async function main(): Promise { + const commonCommandOptions: Deno.CommandOptions = { + stderr: 'piped', + stdout: 'piped', + }; + await runCommands([ { name: 'Biome checks', args: [ Deno.execPath(), { + ...commonCommandOptions, args: ['run', ...permissionArgs('biome'), 'npm:@biomejs/biome', 'ci'], - stderr: 'piped', - stdout: 'piped', }, ], }, @@ -18,9 +22,8 @@ export async function main(): Promise { args: [ Deno.execPath(), { + ...commonCommandOptions, args: ['check'], - stderr: 'piped', - stdout: 'piped', }, ], }, @@ -29,9 +32,8 @@ export async function main(): Promise { args: [ Deno.execPath(), { + ...commonCommandOptions, args: ['test', ...permissionArgs(), '--coverage', '--shuffle'], - stderr: 'piped', - stdout: 'piped', }, ], }, From 959c25476dafa40f129de4bc472f856d2753e90a Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:11:05 -0600 Subject: [PATCH 15/30] chore(deps): add @std/async --- deno.jsonc | 1 + deno.lock | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/deno.jsonc b/deno.jsonc index 29a1b95..e2f2d51 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -11,6 +11,7 @@ "@actions/core": "npm:@actions/core@^1.11.1", "@biomejs/biome": "npm:@biomejs/biome@2.3.6", "@std/assert": "jsr:@std/assert@1.0.16", + "@std/async": "jsr:@std/async@^1.0.15", "@std/testing": "jsr:@std/testing@1.0.16", "@std/fmt": "jsr:@std/fmt@1.0.8", "@std/cli": "jsr:@std/cli@1.0.24", diff --git a/deno.lock b/deno.lock index c049c54..9bf1246 100644 --- a/deno.lock +++ b/deno.lock @@ -3,6 +3,7 @@ "specifiers": { "jsr:@std/assert@1.0.16": "1.0.16", "jsr:@std/assert@^1.0.15": "1.0.16", + "jsr:@std/async@^1.0.15": "1.0.15", "jsr:@std/cli@1.0.24": "1.0.24", "jsr:@std/data-structures@^1.0.9": "1.0.9", "jsr:@std/fmt@1.0.8": "1.0.8", @@ -26,6 +27,9 @@ "jsr:@std/internal" ] }, + "@std/async@1.0.15": { + "integrity": "55d1d9d04f99403fe5730ab16bdcc3c47f658a6bf054cafb38a50f046238116e" + }, "@std/cli@1.0.24": { "integrity": "b655a5beb26aa94f98add6bc8889f5fb9bc3ee2cc3fc954e151201f4c4200a5e", "dependencies": [ @@ -61,6 +65,7 @@ "integrity": "a917ffdeb5924c9be436dc78bc32e511760e14d3a96e49c607fc5ecca86d0092", "dependencies": [ "jsr:@std/assert@^1.0.15", + "jsr:@std/async", "jsr:@std/data-structures", "jsr:@std/fs@^1.0.19", "jsr:@std/internal", @@ -209,6 +214,7 @@ "workspace": { "dependencies": [ "jsr:@std/assert@1.0.16", + "jsr:@std/async@^1.0.15", "jsr:@std/cli@1.0.24", "jsr:@std/fmt@1.0.8", "jsr:@std/fs@1.0.20", From a17c83a2897f23e3c76971cb337cf8cde72bdf5a Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:12:23 -0600 Subject: [PATCH 16/30] fix(scripts/ci): wait a bit to go to the next command's output in CI --- scripts/ci/mod.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/ci/mod.ts b/scripts/ci/mod.ts index 12cc8e9..74389ae 100644 --- a/scripts/ci/mod.ts +++ b/scripts/ci/mod.ts @@ -1,4 +1,5 @@ import { error } from '@actions/core'; +import { delay } from '@std/async'; import { bold, red } from '@std/fmt/colors'; export interface CommandParams { @@ -36,6 +37,10 @@ export async function runCommands( console.log(`\n${bold('-'.repeat(width))}\n\n`); } + + if (isCI()) { + await delay(500); + } } } From d3d25655fadf63822abd04bd225f535a5ab2eb00 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:23:52 -0600 Subject: [PATCH 17/30] ci(infra/actions): remove test run action --- .github/workflows/deno-ci-test-run.yml | 30 -------------------------- 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/deno-ci-test-run.yml diff --git a/.github/workflows/deno-ci-test-run.yml b/.github/workflows/deno-ci-test-run.yml deleted file mode 100644 index 6b30296..0000000 --- a/.github/workflows/deno-ci-test-run.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Deno CI (test run) - -on: - push: - branches: - - infra/actions/denoize - -env: - # Used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed - CACHE_KEY_BASE: deno-ci@v1 - -jobs: - deno-job: - name: Run Deno test run job - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Set up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: 2.x - cache-hash: ${{ env.CACHE_KEY_BASE }}-${{ hashFiles('deno.lock') }} - - - name: Install dependencies - run: deno install - - - name: Run test run script - run: deno run -P=ci @encode/ci From 8a9b545c286f2254fcaf024668023a5b058d7ed6 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:25:39 -0600 Subject: [PATCH 18/30] ci(infra/actions): add main ci reusable workflow --- .github/workflows/fn-ci.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/fn-ci.yml diff --git a/.github/workflows/fn-ci.yml b/.github/workflows/fn-ci.yml new file mode 100644 index 0000000..faa10aa --- /dev/null +++ b/.github/workflows/fn-ci.yml @@ -0,0 +1,43 @@ +name: CI Procedure + +on: + workflow_call: + inputs: + cache-key-base: + description: A string used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed + type: string + required: true + +jobs: + main: + name: Main + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Deno + uses: denoland/setup-deno@v2 + with: + deno-version: 2.x + cache-hash: ${{ inputs.cache-key-base }}-${{ hashFiles('deno.lock') }} + + - name: Install dependencies + run: deno install + + - name: Run main script + run: deno run -P=ci @encode/ci + + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: | + coverage/html + coverage/lcov.info + + - name: Upload raw coverage files + uses: actions/upload-artifact@v4 + with: + name: coverage-report-raw + path: coverage/*.json From 730d4764269b8ee0ed3619414f1a209d8bd0aeab Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:28:56 -0600 Subject: [PATCH 19/30] ci(infra/actions): use new reusable workflow to greatly simplify ci --- .github/workflows/ci.yml | 91 ++-------------------------------------- 1 file changed, 4 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e49aef..51c48c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,91 +4,8 @@ on: push: pull_request: -env: - # Used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed - CACHE_KEY_BASE: ci@v1 - jobs: - setup: - name: Setup - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Set up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: 2.x - cache-hash: ${{ env.CACHE_KEY_BASE }}-${{ hashFiles('deno.lock') }} - - - name: Install dependencies - run: deno install - - test: - name: Test - needs: [setup] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - # Now the Deno cache should be warmed up, so this should be much faster - - name: Set up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: 2.x - cache-hash: ${{ env.CACHE_KEY_BASE }}-${{ hashFiles('deno.lock') }} - - - name: Test - run: deno test -P --no-prompt --coverage --shuffle - - - name: Upload coverage report - uses: actions/upload-artifact@v4 - with: - name: coverage-report - path: | - coverage/html - coverage/lcov.info - - - name: Upload raw coverage files - uses: actions/upload-artifact@v4 - with: - name: coverage-report-raw - path: coverage/*.json - - lint: - name: Lint - needs: [setup] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - # Now the Deno cache should be warmed up, so this should be much faster - - name: Set up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: 2.x - cache-hash: ${{ env.CACHE_KEY_BASE }}-${{ hashFiles('deno.lock') }} - - - name: Lint - run: deno run --allow-env --allow-run --no-prompt npm:@biomejs/biome ci - - check: - name: Check - needs: [setup] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - # Now the Deno cache should be warmed up, so this should be much faster - - name: Set up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: 2.x - cache-hash: ${{ env.CACHE_KEY_BASE }}-${{ hashFiles('deno.lock') }} - - - name: Lint - run: deno check + run-procedure: + uses: ./.github/workflows/fn-ci.yml + with: + cache-key-base: ci@v1 From 3fa979caef37e421f4b15e13e0e59708aeeda827 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:30:42 -0600 Subject: [PATCH 20/30] ci(infra/actions): add name to workflow call --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51c48c8..1496b21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: jobs: run-procedure: + name: Run CI Procedure uses: ./.github/workflows/fn-ci.yml with: cache-key-base: ci@v1 From 97c24630254250242f84c7aa9ddda701c8e6817b Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Thu, 20 Nov 2025 06:49:17 -0600 Subject: [PATCH 21/30] ci(infra/actions): rename job Rename job for easier time finding in branch protection rules --- .github/workflows/fn-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fn-ci.yml b/.github/workflows/fn-ci.yml index faa10aa..b9d2931 100644 --- a/.github/workflows/fn-ci.yml +++ b/.github/workflows/fn-ci.yml @@ -9,8 +9,8 @@ on: required: true jobs: - main: - name: Main + main-checks: + name: Main Checks runs-on: ubuntu-latest steps: - name: Checkout repository From 59672aa9625da02f1cced5dded7f1eb88547e115 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:53:01 -0600 Subject: [PATCH 22/30] chore(deps): add @actions/github --- deno.jsonc | 1 + deno.lock | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/deno.jsonc b/deno.jsonc index e2f2d51..25641fe 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -9,6 +9,7 @@ "imports": { "@actions/core": "npm:@actions/core@^1.11.1", + "@actions/github": "npm:@actions/github@^6.0.1", "@biomejs/biome": "npm:@biomejs/biome@2.3.6", "@std/assert": "jsr:@std/assert@1.0.16", "@std/async": "jsr:@std/async@^1.0.15", diff --git a/deno.lock b/deno.lock index 9bf1246..0a9a588 100644 --- a/deno.lock +++ b/deno.lock @@ -15,6 +15,7 @@ "jsr:@std/path@^1.1.3": "1.1.3", "jsr:@std/testing@1.0.16": "1.0.16", "npm:@actions/core@^1.11.1": "1.11.1", + "npm:@actions/github@^6.0.1": "6.0.1_@octokit+core@5.2.2", "npm:@biomejs/biome@*": "2.3.6", "npm:@biomejs/biome@2.3.6": "2.3.6", "npm:@types/node@*": "24.2.0", @@ -87,6 +88,18 @@ "@actions/io" ] }, + "@actions/github@6.0.1_@octokit+core@5.2.2": { + "integrity": "sha512-xbZVcaqD4XnQAe35qSQqskb3SqIAfRyLBrHMd/8TuL7hJSz2QtbDwnNM8zWx4zO5l2fnGtseNE3MbEvD7BxVMw==", + "dependencies": [ + "@actions/http-client", + "@octokit/core", + "@octokit/plugin-paginate-rest", + "@octokit/plugin-rest-endpoint-methods", + "@octokit/request", + "@octokit/request-error", + "undici" + ] + }, "@actions/http-client@2.2.3": { "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", "dependencies": [ @@ -178,12 +191,94 @@ "@fastify/busboy@2.1.1": { "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==" }, + "@octokit/auth-token@4.0.0": { + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==" + }, + "@octokit/core@5.2.2": { + "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", + "dependencies": [ + "@octokit/auth-token", + "@octokit/graphql", + "@octokit/request", + "@octokit/request-error", + "@octokit/types@13.10.0", + "before-after-hook", + "universal-user-agent" + ] + }, + "@octokit/endpoint@9.0.6": { + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "dependencies": [ + "@octokit/types@13.10.0", + "universal-user-agent" + ] + }, + "@octokit/graphql@7.1.1": { + "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", + "dependencies": [ + "@octokit/request", + "@octokit/types@13.10.0", + "universal-user-agent" + ] + }, + "@octokit/openapi-types@20.0.0": { + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==" + }, + "@octokit/openapi-types@24.2.0": { + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==" + }, + "@octokit/plugin-paginate-rest@9.2.2_@octokit+core@5.2.2": { + "integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==", + "dependencies": [ + "@octokit/core", + "@octokit/types@12.6.0" + ] + }, + "@octokit/plugin-rest-endpoint-methods@10.4.1_@octokit+core@5.2.2": { + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dependencies": [ + "@octokit/core", + "@octokit/types@12.6.0" + ] + }, + "@octokit/request-error@5.1.1": { + "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", + "dependencies": [ + "@octokit/types@13.10.0", + "deprecation", + "once" + ] + }, + "@octokit/request@8.4.1": { + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", + "dependencies": [ + "@octokit/endpoint", + "@octokit/request-error", + "@octokit/types@13.10.0", + "universal-user-agent" + ] + }, + "@octokit/types@12.6.0": { + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dependencies": [ + "@octokit/openapi-types@20.0.0" + ] + }, + "@octokit/types@13.10.0": { + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dependencies": [ + "@octokit/openapi-types@24.2.0" + ] + }, "@types/node@24.2.0": { "integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==", "dependencies": [ "undici-types" ] }, + "before-after-hook@2.2.3": { + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" + }, "chevrotain@11.0.3": { "integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==", "dependencies": [ @@ -195,9 +290,18 @@ "lodash-es" ] }, + "deprecation@2.3.1": { + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, "lodash-es@4.17.21": { "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, + "once@1.4.0": { + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": [ + "wrappy" + ] + }, "tunnel@0.0.6": { "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, @@ -209,6 +313,12 @@ "dependencies": [ "@fastify/busboy" ] + }, + "universal-user-agent@6.0.1": { + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==" + }, + "wrappy@1.0.2": { + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" } }, "workspace": { @@ -221,6 +331,7 @@ "jsr:@std/path@1.1.3", "jsr:@std/testing@1.0.16", "npm:@actions/core@^1.11.1", + "npm:@actions/github@^6.0.1", "npm:@biomejs/biome@2.3.6", "npm:chevrotain@^11.0.3" ] From 2e9cf2dfa4426d1692b657bbed2451bb0237c241 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:59:13 -0600 Subject: [PATCH 23/30] ci(scripts/clean-up-caches): add @encode/clean-up-caches --- scripts/clean-up-caches/deno.jsonc | 14 ++++++++++++++ scripts/clean-up-caches/main.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 scripts/clean-up-caches/deno.jsonc create mode 100644 scripts/clean-up-caches/main.ts diff --git a/scripts/clean-up-caches/deno.jsonc b/scripts/clean-up-caches/deno.jsonc new file mode 100644 index 0000000..53a4952 --- /dev/null +++ b/scripts/clean-up-caches/deno.jsonc @@ -0,0 +1,14 @@ +{ + "name": "@encode/clean-up-caches", + "version": "0.1.0", + + "exports": { + ".": "./main.ts", + + "./lib": "./mod.ts" + }, + + "imports": { + "@/": "./" + } +} diff --git a/scripts/clean-up-caches/main.ts b/scripts/clean-up-caches/main.ts new file mode 100644 index 0000000..823d445 --- /dev/null +++ b/scripts/clean-up-caches/main.ts @@ -0,0 +1,28 @@ +import { getInput } from '@actions/core'; +import { context, getOctokit } from '@actions/github'; + +export async function main(): Promise { + const github = getOctokit(getInput('token', { required: true })); + const actions = github.rest.actions; + + const { + data: { actions_caches: caches }, + } = await actions.getActionsCacheList({ + ...context.repo, + ref: context.ref, + }); + + console.debug({ caches }); + + // const cacheDeletionReqs = caches.flatMap(({ id }) => { + // if (!id) return []; + + // return actions.deleteActionsCacheById({ ...context.repo, cache_id: id }); + // }); + + // await Promise.all(cacheDeletionReqs); +} + +if (import.meta.main) { + await main(); +} From e94fbd8a15357cab9434b50dfca2296e649cf5c0 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:29:33 -0600 Subject: [PATCH 24/30] ci(actions/clean-up-caches): add action to clean caches --- .github/workflows/clean-up-caches.yml | 13 +++++++++ .github/workflows/fn-clean-up-caches.yml | 34 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/clean-up-caches.yml create mode 100644 .github/workflows/fn-clean-up-caches.yml diff --git a/.github/workflows/clean-up-caches.yml b/.github/workflows/clean-up-caches.yml new file mode 100644 index 0000000..9cf4026 --- /dev/null +++ b/.github/workflows/clean-up-caches.yml @@ -0,0 +1,13 @@ +name: Clean Up Caches (Debug) + +on: + push: + branches: + - infra/actions/denoize + +jobs: + run-procedure: + name: Run Clean Up Caches Procedure + uses: ./.github/workflows/fn-clean-up-caches.yml + with: + cache-key-base: clean-up-caches@v1 diff --git a/.github/workflows/fn-clean-up-caches.yml b/.github/workflows/fn-clean-up-caches.yml new file mode 100644 index 0000000..fb83993 --- /dev/null +++ b/.github/workflows/fn-clean-up-caches.yml @@ -0,0 +1,34 @@ +name: Clean Up Caches Procedure + +on: + workflow_call: + inputs: + cache-key-base: + description: A string used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed + type: string + required: true + token: + description: The auth token to use + type: string + required: false + default: ${{ github.token }} + +jobs: + main: + name: Main + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Deno + uses: denoland/setup-deno@v2 + with: + deno-version: 2.x + cache-hash: ${{ inputs.cache-key-base }}-${{ hashFiles('deno.lock') }} + + - name: Install dependencies + run: deno install + + - name: Run main script + run: deno run -P=ci @encode/clean-up-caches From 0c4ef0eab040fca0dc82625e2615be3cef4c56a9 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:35:29 -0600 Subject: [PATCH 25/30] ci(actions/clean-up-caches): fix insufficient permissions --- .github/workflows/fn-clean-up-caches.yml | 2 +- deno.jsonc | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fn-clean-up-caches.yml b/.github/workflows/fn-clean-up-caches.yml index fb83993..11723ff 100644 --- a/.github/workflows/fn-clean-up-caches.yml +++ b/.github/workflows/fn-clean-up-caches.yml @@ -31,4 +31,4 @@ jobs: run: deno install - name: Run main script - run: deno run -P=ci @encode/clean-up-caches + run: deno run -P=ci.clean-up-caches @encode/clean-up-caches diff --git a/deno.jsonc b/deno.jsonc index 25641fe..99d6398 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -38,6 +38,11 @@ "ci": { "env": true, "run": ["deno"] + }, + + "ci.clean-up-caches": { + "env": true, + "read": ["/home/runner/work/_temp/_github_workflow/event.json"] } }, From f107b6532933efaa9d8453235efd7227f1d4ca5e Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:40:14 -0600 Subject: [PATCH 26/30] ci(@encode/clean-up-caches): use Deno env instead of GitHub inputs --- scripts/clean-up-caches/main.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/clean-up-caches/main.ts b/scripts/clean-up-caches/main.ts index 823d445..a2cbc5e 100644 --- a/scripts/clean-up-caches/main.ts +++ b/scripts/clean-up-caches/main.ts @@ -1,8 +1,11 @@ -import { getInput } from '@actions/core'; import { context, getOctokit } from '@actions/github'; +import { assertExists } from '@std/assert'; export async function main(): Promise { - const github = getOctokit(getInput('token', { required: true })); + const token = Deno.env.get('GITHUB_TOKEN'); + assertExists(token); + + const github = getOctokit(token); const actions = github.rest.actions; const { From 4f6e85ad49a24f5f6ac58a2c6287898c19d04f04 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:44:26 -0600 Subject: [PATCH 27/30] ci(actions/clean-up-caches): pass in token as env var --- .github/workflows/fn-clean-up-caches.yml | 7 ++----- scripts/clean-up-caches/main.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/fn-clean-up-caches.yml b/.github/workflows/fn-clean-up-caches.yml index 11723ff..3b2eaa7 100644 --- a/.github/workflows/fn-clean-up-caches.yml +++ b/.github/workflows/fn-clean-up-caches.yml @@ -7,11 +7,6 @@ on: description: A string used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed type: string required: true - token: - description: The auth token to use - type: string - required: false - default: ${{ github.token }} jobs: main: @@ -32,3 +27,5 @@ jobs: - name: Run main script run: deno run -P=ci.clean-up-caches @encode/clean-up-caches + env: + TOKEN: ${{ github.token }} diff --git a/scripts/clean-up-caches/main.ts b/scripts/clean-up-caches/main.ts index a2cbc5e..9346fd2 100644 --- a/scripts/clean-up-caches/main.ts +++ b/scripts/clean-up-caches/main.ts @@ -2,7 +2,7 @@ import { context, getOctokit } from '@actions/github'; import { assertExists } from '@std/assert'; export async function main(): Promise { - const token = Deno.env.get('GITHUB_TOKEN'); + const token = Deno.env.get('TOKEN'); assertExists(token); const github = getOctokit(token); From f73b35869e5f048b47513fd4face14a7a52e5eeb Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:51:27 -0600 Subject: [PATCH 28/30] ci(actions/clean-up-caches): add permissions --- .github/workflows/fn-clean-up-caches.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/fn-clean-up-caches.yml b/.github/workflows/fn-clean-up-caches.yml index 3b2eaa7..6a4a968 100644 --- a/.github/workflows/fn-clean-up-caches.yml +++ b/.github/workflows/fn-clean-up-caches.yml @@ -8,6 +8,9 @@ on: type: string required: true +permissions: + actions: write + jobs: main: name: Main From 1e70958e3407056f87a43a8b6a89c7a29b6d810b Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:53:05 -0600 Subject: [PATCH 29/30] ci(actions/clean-up-caches): add permissions everywhere needed --- .github/workflows/clean-up-caches.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/clean-up-caches.yml b/.github/workflows/clean-up-caches.yml index 9cf4026..efdb557 100644 --- a/.github/workflows/clean-up-caches.yml +++ b/.github/workflows/clean-up-caches.yml @@ -5,6 +5,9 @@ on: branches: - infra/actions/denoize +permissions: + actions: write + jobs: run-procedure: name: Run Clean Up Caches Procedure From e4bae138990a16f20427a519f721e2743a26d8e3 Mon Sep 17 00:00:00 2001 From: Benjamin Laird <86321957+ben-laird@users.noreply.github.com> Date: Fri, 21 Nov 2025 21:16:12 -0600 Subject: [PATCH 30/30] ci(actions/clean-up-caches): remove actions/clean-up-caches --- .github/workflows/clean-up-caches.yml | 16 ----------- .github/workflows/fn-clean-up-caches.yml | 34 ------------------------ deno.jsonc | 5 ---- scripts/clean-up-caches/deno.jsonc | 14 ---------- scripts/clean-up-caches/main.ts | 31 --------------------- 5 files changed, 100 deletions(-) delete mode 100644 .github/workflows/clean-up-caches.yml delete mode 100644 .github/workflows/fn-clean-up-caches.yml delete mode 100644 scripts/clean-up-caches/deno.jsonc delete mode 100644 scripts/clean-up-caches/main.ts diff --git a/.github/workflows/clean-up-caches.yml b/.github/workflows/clean-up-caches.yml deleted file mode 100644 index efdb557..0000000 --- a/.github/workflows/clean-up-caches.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Clean Up Caches (Debug) - -on: - push: - branches: - - infra/actions/denoize - -permissions: - actions: write - -jobs: - run-procedure: - name: Run Clean Up Caches Procedure - uses: ./.github/workflows/fn-clean-up-caches.yml - with: - cache-key-base: clean-up-caches@v1 diff --git a/.github/workflows/fn-clean-up-caches.yml b/.github/workflows/fn-clean-up-caches.yml deleted file mode 100644 index 6a4a968..0000000 --- a/.github/workflows/fn-clean-up-caches.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Clean Up Caches Procedure - -on: - workflow_call: - inputs: - cache-key-base: - description: A string used to differentiate from other slices of the cache for other workflow runs, and to forcefully bust the cache when renamed - type: string - required: true - -permissions: - actions: write - -jobs: - main: - name: Main - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Set up Deno - uses: denoland/setup-deno@v2 - with: - deno-version: 2.x - cache-hash: ${{ inputs.cache-key-base }}-${{ hashFiles('deno.lock') }} - - - name: Install dependencies - run: deno install - - - name: Run main script - run: deno run -P=ci.clean-up-caches @encode/clean-up-caches - env: - TOKEN: ${{ github.token }} diff --git a/deno.jsonc b/deno.jsonc index 99d6398..25641fe 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -38,11 +38,6 @@ "ci": { "env": true, "run": ["deno"] - }, - - "ci.clean-up-caches": { - "env": true, - "read": ["/home/runner/work/_temp/_github_workflow/event.json"] } }, diff --git a/scripts/clean-up-caches/deno.jsonc b/scripts/clean-up-caches/deno.jsonc deleted file mode 100644 index 53a4952..0000000 --- a/scripts/clean-up-caches/deno.jsonc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@encode/clean-up-caches", - "version": "0.1.0", - - "exports": { - ".": "./main.ts", - - "./lib": "./mod.ts" - }, - - "imports": { - "@/": "./" - } -} diff --git a/scripts/clean-up-caches/main.ts b/scripts/clean-up-caches/main.ts deleted file mode 100644 index 9346fd2..0000000 --- a/scripts/clean-up-caches/main.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { context, getOctokit } from '@actions/github'; -import { assertExists } from '@std/assert'; - -export async function main(): Promise { - const token = Deno.env.get('TOKEN'); - assertExists(token); - - const github = getOctokit(token); - const actions = github.rest.actions; - - const { - data: { actions_caches: caches }, - } = await actions.getActionsCacheList({ - ...context.repo, - ref: context.ref, - }); - - console.debug({ caches }); - - // const cacheDeletionReqs = caches.flatMap(({ id }) => { - // if (!id) return []; - - // return actions.deleteActionsCacheById({ ...context.repo, cache_id: id }); - // }); - - // await Promise.all(cacheDeletionReqs); -} - -if (import.meta.main) { - await main(); -}