Skip to content

fix(apply-repo-settings): surface full API error body on failures#35

Merged
nsheaps merged 1 commit into
mainfrom
claude/practical-shannon-a2n2d
May 29, 2026
Merged

fix(apply-repo-settings): surface full API error body on failures#35
nsheaps merged 1 commit into
mainfrom
claude/practical-shannon-a2n2d

Conversation

@jack-nsheaps
Copy link
Copy Markdown
Contributor

@jack-nsheaps jack-nsheaps Bot commented May 28, 2026

Summary

  • Replaces gh api with curl in api() to capture full HTTP response body on non-2xx responses — previously gh api discarded the JSON validation detail on 422s, leaving only "Validation Failed" in the logs
  • Adds runtime substitution of actor_id: -1 placeholder for Integration bypass actors: the action now reads APP_ID from env (sourced from inputs.app-id / AUTOMATION_GITHUB_APP_ID secret) and replaces -1 with the real GitHub App ID via jq before each API call
  • If APP_ID is unset, Integration bypass actors with actor_id == -1 are dropped with a warning (graceful degradation)

Why

GitHub Rulesets API requires actor_id for actor_type: Integration to be the GitHub App ID (integer), not the installation ID. The App ID lives in 1Password at op://heapsinfra/github--app--automation/AUTOMATION_GITHUB_APP_ID and is synced to CI via the secret sync workflow — but can't be embedded statically in YAML across repos, hence the runtime substitution pattern.

Test plan

  • CI passes on this PR
  • After merge, trigger apply-repo-settings on a repo with Integration bypass actors configured (actor_id: -1) and confirm no HTTP 422 and correct actor_id in the resulting ruleset

https://claude.ai/code/session_01XUJx6sKWxyKyoWdxNEsET1

…Integration bypass actors

Two related fixes for ruleset apply failures:

1. Use curl in api() to surface full error body on non-2xx responses.
   Previously, `gh api` on a 422 only emitted "gh: Validation Failed (HTTP 422)"
   to stderr — the JSON field-level detail was discarded. Now the full response
   body is printed via `::error::` so CI logs show exactly what GitHub rejected.

2. Substitute actor_id -1 placeholder with real AUTOMATION_GITHUB_APP_ID for
   Integration bypass actors. GitHub Rulesets API requires actor_id to be the
   App ID (integer), not the installation ID. The App ID is passed via APP_ID
   env var (sourced from inputs.app-id / AUTOMATION_GITHUB_APP_ID secret) and
   substituted with jq before each API call. If APP_ID is unset, placeholder
   Integration actors are dropped with a warning (graceful degradation).

https://claude.ai/code/session_01XUJx6sKWxyKyoWdxNEsET1
@nsheaps nsheaps force-pushed the claude/practical-shannon-a2n2d branch from 713aa66 to 9f972e1 Compare May 29, 2026 00:08
@nsheaps nsheaps marked this pull request as ready for review May 29, 2026 01:10
@nsheaps nsheaps merged commit 2b10cb5 into main May 29, 2026
2 checks passed
@nsheaps nsheaps deleted the claude/practical-shannon-a2n2d branch May 29, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants