ci(claude): fix yq expression in auth-gate-invariants validator#453
Merged
ci(claude): fix yq expression in auth-gate-invariants validator#453
Conversation
Symptom: every PR was failing `Auth gate invariants / validate` with `authorize job has no step setting USERS_TO_CHECK env var`, even on workflows that clearly set it. Reported on PR #452 and others. Cause: the check `USERS_TO_CHECK presence` (added in #417 review- fixup) was using a jq-flavored expression — `// empty` in particular — but yq on ubuntu-latest is `mikefarah/yq` (Go), not jq. yq's lexer rejects `empty`. The script had `2>/dev/null` on the yq invocation, so the lexer error was eaten and the variable came back as the empty string, tripping the existence check on every workflow. Fix: rewrite the expression in idiomatic yq: - `.jobs.authorize.steps[].env.USERS_TO_CHECK | select(. != null)` — emits a stream of one value per step that sets the env var, skipping steps that don't. - `head -1` collapses the stream to a single value (or empty) for the `[ -n ]` check. Verified locally with mikefarah/yq v4.53.2 against all three harper claude-*.yml workflows — all pass. Out of scope but worth following up: - The `2>/dev/null` swallowed a real yq error. Worth either removing the suppression or capturing stderr for diagnostics when the expression returns empty. - oauth's mirror (#68) carries the same bug; a copy of this fix needs to land there too. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Reviewed; no blockers found. |
cb1kenobi
approved these changes
May 2, 2026
heskew
added a commit
to HarperFast/oauth
that referenced
this pull request
May 2, 2026
Mirror of HarperFast/harper#453. Same one-line fix. The validator's USERS_TO_CHECK presence check used jq's `// empty` keyword, but ubuntu-latest's yq is mikefarah/yq (Go). yq's lexer rejects `empty`; `2>/dev/null` ate the error; the variable came back empty; the existence check tripped on every workflow. Replaces the expression with idiomatic yq: `.jobs.authorize.steps[].env.USERS_TO_CHECK | select(. != null)` piped through `head -1`. Verified locally with mikefarah/yq v4.53.2 against all three oauth claude-*.yml workflows — all pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every PR has been failing `Auth gate invariants / validate` with:
```
=== Validating .github/workflows/claude-issue-to-pr.yml ===
Error: .github/workflows/claude-issue-to-pr.yml: authorize job has no step setting USERS_TO_CHECK env var ...
Error: Process completed with exit code 1.
```
…even on workflows that clearly set `USERS_TO_CHECK`. Reproduced locally — the validator's check uses jq's `// empty` keyword, but the runner's yq is mikefarah/yq (Go), which doesn't have it. yq's lexer rejects the expression; `2>/dev/null` swallowed the error; the variable came back empty; the existence check tripped on every workflow.
Fix
Rewrite the yq expression in idiomatic mikefarah/yq syntax:
`select(. != null)` skips steps without the env var; `head -1` collapses the per-step stream to a single value (or empty) for the `[ -n ]` check.
Verified locally with mikefarah/yq v4.53.2 against all three harper `claude-*.yml` workflows — all pass.
Out of scope (followups)
Test plan
🤖 Generated with Claude Code