Skip to content

refactor(ci): replace actions/github-script with gh CLI in amber-issue-handler#601

Open
jeremyeder wants to merge 1 commit intoambient-code:mainfrom
jeremyeder:refactor/amber-handler-gh-cli
Open

refactor(ci): replace actions/github-script with gh CLI in amber-issue-handler#601
jeremyeder wants to merge 1 commit intoambient-code:mainfrom
jeremyeder:refactor/amber-handler-gh-cli

Conversation

@jeremyeder
Copy link
Collaborator

Summary

  • Replace all 5 actions/github-script@v8 blocks with gh CLI equivalents, eliminating the JavaScript dependency entirely
  • Remove ~40 lines of retry/backoff infrastructure (retryWithBackoff, safeComment) — if gh fails, the step fails, and the existing "Report failure" step handles notification
  • Simplify "Check for existing PR" to use gh pr list --search instead of complex jq regex matching

Net reduction: 296 deletions, 137 insertions (-159 lines, from 656 → 496)

What changed

Step Before After
Extract issue details actions/github-script@v8 with Octokit + regex parsing gh issue view + jq
Check for existing PR Complex jq regex test("Closes #N($|[^0-9])") gh pr list --search "Closes #N"
Report no changes 35-line JS block gh issue comment
Validate changes JS execFile('git', ['diff']) + Octokit comment Shell git diff --stat + gh issue comment
Create/update PR 170-line JS with retry/backoff gh pr create / gh pr comment (~60 lines)
Report failure 45-line JS block gh issue comment (~15 lines)

What did NOT change

  • Trigger configuration (on: issues/issue_comment)
  • Permissions block (including id-token: write)
  • Determine Amber action type step
  • Create Amber agent prompt step
  • Create or checkout feature branch step (with all validation)
  • Claude Code execution step
  • Check if changes were made step

Test plan

  • Verify YAML is valid (python3 -c "import yaml; yaml.safe_load(open(...))" — passed)
  • Verify actionlint passes (all findings are pre-existing shellcheck info — passed)
  • Verify no actions/github-script references remain (grep — passed)
  • Label a test issue with amber:auto-fix and verify full flow
  • Trigger on an issue that produces no changes → verify "no changes" comment
  • Re-label same issue → verify existing PR detection and update comment

Closes #600

🤖 Generated with Claude Code

…e-handler

Replace all 5 `actions/github-script@v8` blocks with `gh` CLI equivalents:

- Extract issue details: `gh issue view` + `jq` instead of Octokit JS
- Report no changes: `gh issue comment` instead of 35-line JS block
- Validate changes: shell `git diff --stat` + `gh issue comment`
- Create/update PR: `gh pr create` / `gh pr comment` instead of 170-line
  JS block with retry/backoff infrastructure
- Report failure: `gh issue comment` instead of 45-line JS block

Also simplifies "Check for existing PR" to use `gh pr list --search`
instead of complex jq regex matching on PR bodies.

Removes retry/backoff infrastructure entirely (~40 lines of
retryWithBackoff + safeComment) — if gh fails, the step fails, and the
existing "Report failure" step handles notification.

Drops regex-based file path extraction from issue body (Claude receives
the full issue body via the prompt template and can identify files itself).

Net reduction: 296 deletions, 137 insertions (-159 lines).

Closes ambient-code#600

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremyeder
Copy link
Collaborator Author

refactor. features rename the same.

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.

refactor: replace actions/github-script with gh CLI in amber-issue-handler

1 participant