Skip to content

fix(ci): resolve HTTP 422 on homebrew-tap dispatch#41

Merged
wax911 merged 2 commits into
mainfrom
ci/fix-homebrew-dispatch-422
Jul 13, 2026
Merged

fix(ci): resolve HTTP 422 on homebrew-tap dispatch#41
wax911 merged 2 commits into
mainfrom
ci/fix-homebrew-dispatch-422

Conversation

@wax911

@wax911 wax911 commented Jul 13, 2026

Copy link
Copy Markdown
Member

Description

Fixes the repository_dispatch API call to AniTrend/homebrew-tap that fails with HTTP 422 on every release tag push.

Root cause

gh api -f client_payload='{"version":"${{ github.ref_name }}"}' sends client_payload as a JSON string because -f (--raw-field) always serializes values as strings. GitHub's API expects a nested JSON object.

Broken (HTTP 422):

{"event_type": "stackctl-release", "client_payload": "{\"version\":\"v0.0.1\"}"}

Fixed:

{"event_type": "stackctl-release", "client_payload": {"version": "v0.0.1"}}

Changes

  • Replaced -f flags with --input - heredoc producing properly nested JSON
  • Moved github.ref_name to env: variable for security hardening
  • Removed continue-on-error: true so future failures are visible
  • Added id: dispatch-homebrew to the step

Evidence

Error from run 29265882314:

gh: Invalid request.
For 'properties/client_payload', ... is not an object. (HTTP 422)

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-actions github-actions Bot added the 👷 ci CI/CD pipeline changes label Jul 13, 2026
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
@wax911
wax911 merged commit 0ab8430 into main Jul 13, 2026
5 checks passed
@wax911
wax911 deleted the ci/fix-homebrew-dispatch-422 branch July 13, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👷 ci CI/CD pipeline changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant