Skip to content

ci(action): drop jq dependency, guard gh, declare Node >=20 engine#52

Merged
Conalh merged 1 commit into
mainfrom
pr6-action-portability
May 29, 2026
Merged

ci(action): drop jq dependency, guard gh, declare Node >=20 engine#52
Conalh merged 1 commit into
mainfrom
pr6-action-portability

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented May 29, 2026

Addresses review findings #8 and #9.

#8 — Action portability

The composite Action parsed the PR event payload with the standalone jq binary (base SHA, PR number) and invoked gh unconditionally for the sticky comment. Both ship on GitHub-hosted Ubuntu but can be missing on self-hosted / minimal runners, failing the step hard.

  • Drop jq: read the PR base SHA and number from GITHUB_EVENT_PATH with Node (always available — this is a Node action), each wrapped in try/catch so a missing/malformed event degrades to empty instead of aborting under set -e.
    • The gh api --jq … filter is gh's built-in jq, not the binary, so it stays.
  • Guard gh: wrap the sticky-comment block in command -v gh; when gh is absent, emit a ::notice and skip rather than fail — the Markdown report is already in the step summary.

#9 — Node engine

Declare "engines": { "node": ">=20" } in package.json and keep the lockfile's root entry in sync, so running the CLI on an unsupported Node version surfaces a clear error. (agent-gov-core already requires >=20.)

Tests

Verified the Node extraction snippets behave (correct values; empty on missing file). New tests assert the action no longer uses the jq binary for the event, reads it via process.env.GITHUB_EVENT_PATH, guards gh with command -v, and that both package.json and the lockfile declare the engine. All 120 tests pass.

🤖 Generated with Claude Code

The composite Action parsed the PR event payload with the standalone `jq`
binary (base SHA, PR number) and called `gh` unconditionally for the sticky
comment. Both are present on GitHub-hosted Ubuntu but can be missing on
self-hosted or minimal runners, failing the step hard.

- Read the PR base SHA and number from GITHUB_EVENT_PATH with Node (always
  available — this is a Node action), wrapped in try/catch so a missing or
  malformed event degrades to empty rather than aborting under `set -e`.
  (The `gh api --jq` filter is gh's built-in jq, not the binary, so it stays.)
- Guard the sticky-comment block with `command -v gh`; emit a ::notice and
  skip when gh is absent instead of failing — the Markdown report is still in
  the step summary.
- Declare engines.node ">=20" in package.json (and the lockfile's root entry)
  so local CLI failure modes on old Node are obvious.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Conalh Conalh merged commit b616f06 into main May 29, 2026
5 checks passed
@Conalh Conalh deleted the pr6-action-portability branch May 29, 2026 15:58
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.

1 participant