Skip to content

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

@jeremyeder

Description

@jeremyeder

Why

The amber-issue-handler workflow is ~656 lines. Five actions/github-script@v8 blocks contain inline JavaScript (including ~170 lines of retry/backoff infrastructure) that can be replaced with gh CLI commands — cutting the file roughly in half, making it easier to maintain, and eliminating the Octokit JS dependency.

gh CLI is natively available in GitHub Actions runners and well-supported by Claude Code for future modifications.

Changes (in order)

  1. Extract issue details — Replace actions/github-script with gh issue view + jq (~30 lines saved)
  2. Check for existing PR — Simplify complex jq regex to gh pr list --search (~10 lines saved)
  3. Report no changes — Replace actions/github-script with gh issue comment (~20 lines saved)
  4. Validate changes — Replace actions/github-script + execFile with git diff --stat + gh issue comment (~25 lines saved)
  5. Create or Update PR — Replace actions/github-script (including retryWithBackoff/safeComment infrastructure) with gh pr create + gh pr edit --add-label + gh issue comment (~110 lines saved)
  6. Report failure — Replace actions/github-script with gh issue comment (~25 lines saved)

Estimated total: ~220 lines saved, 0 actions/github-script blocks remaining.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions