From 139b5a5f9871c7352f8e37a58f96ae5a2e91896b Mon Sep 17 00:00:00 2001 From: Maxwell Date: Mon, 13 Jul 2026 20:01:45 +0200 Subject: [PATCH 1/2] fix(ci): resolve HTTP 422 on homebrew-tap dispatch The repository_dispatch API call was sending client_payload as a JSON string instead of a nested object because gh api --raw-field (-f) always serialises values as strings. Changed to --input - with a heredoc that produces properly nested JSON. Also removed continue-on-error so future failures are visible, moved github.ref_name into an env var for security hardening, and added an id to the step. --- .github/workflows/release.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4462186..81bbb80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,14 +97,20 @@ jobs: repositories: homebrew-tap - name: Dispatch homebrew-tap formula update + id: dispatch-homebrew if: vars.ENABLE_HOMEBREW_DISPATCH == 'true' - continue-on-error: true env: GH_TOKEN: ${{ steps.app-token.outputs.token }} + RELEASE_VERSION: ${{ github.ref_name }} run: | gh api \ --method POST \ - -H "Accept: application/vnd.github+json" \ /repos/AniTrend/homebrew-tap/dispatches \ - -f event_type='stackctl-release' \ - -f client_payload="{\"version\":\"${{ github.ref_name }}\"}" + --input - < Date: Mon, 13 Jul 2026 20:11:43 +0200 Subject: [PATCH 2/2] test: decouple version tests from hardcoded version string The version tests were hardcoding VERSION as "0.1.0-dev" which breaks whenever version-bump.yml updates the constant. Changed: - version_test.ts: assert VERSION matches semver-or-dev pattern (/^\d+\.\d+\.\d+(-dev)?$/) instead of exact equality - cli/mod_test.ts: compare cmd.getVersion() against imported VERSION constant instead of hardcoded string --- src/cli/mod_test.ts | 3 ++- src/version_test.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cli/mod_test.ts b/src/cli/mod_test.ts index e81daa7..8424d65 100644 --- a/src/cli/mod_test.ts +++ b/src/cli/mod_test.ts @@ -1,5 +1,6 @@ import { assertEquals } from "@std/assert"; import { buildCli } from "../cli/mod.ts"; +import { VERSION } from "../version.ts"; Deno.test("buildCli returns stackctl command", () => { const cmd = buildCli(); @@ -45,5 +46,5 @@ Deno.test("buildCli produces correct help output smoke test", () => { Deno.test("buildCli version is set", () => { const cmd = buildCli(); - assertEquals(cmd.getVersion(), "0.1.0-dev"); + assertEquals(cmd.getVersion(), VERSION); }); diff --git a/src/version_test.ts b/src/version_test.ts index 5ab4344..9e1c815 100644 --- a/src/version_test.ts +++ b/src/version_test.ts @@ -1,6 +1,6 @@ -import { assertEquals } from "@std/assert"; +import { assertMatch } from "@std/assert"; import { VERSION } from "./version.ts"; -Deno.test("VERSION is dev", () => { - assertEquals(VERSION, "0.1.0-dev"); +Deno.test("VERSION is set and follows semver pattern", () => { + assertMatch(VERSION, /^\d+\.\d+\.\d+(-dev)?$/); });