surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
Updates edit-issue-labels.sh and comment-on-duplicates.sh to read the issue number from GITHUB_EVENT_PATH (the workflow event payload) instead of accepting it as a CLI argument. Simplifies the call signature and keeps the scripts aligned with the triggering issue. Also updates the /triage-issue and /dedupe command docs to match. :house: Remote-Dev: homespace
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | 4. Next, feed the results from #1 and #2 into another agent, so that it can filter out false positives, that are likely not actually duplicates of the original issue. If there are no duplicates remaining, do not proceed. |
| 14 | 14 | 5. Finally, use the comment script to post duplicates: |
| 15 | 15 | ``` |
| 16 | - ./scripts/comment-on-duplicates.sh --base-issue <issue-number> --potential-duplicates <dup1> <dup2> <dup3> | |
| 16 | + ./scripts/comment-on-duplicates.sh --potential-duplicates <dup1> <dup2> <dup3> | |
| 17 | 17 | ``` |
| 18 | 18 | |
| 19 | 19 | Notes (be sure to tell this to your agents, too): |
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | - `./scripts/gh.sh issue list --state open --limit 20` — list issues |
| 21 | 21 | - `./scripts/gh.sh search issues "query"` — find similar or duplicate issues |
| 22 | 22 | - `./scripts/gh.sh search issues "query" --limit 10` — search with limit |
| 23 | -- `./scripts/edit-issue-labels.sh --issue NUMBER --add-label LABEL --remove-label LABEL` — add or remove labels | |
| 23 | +- `./scripts/edit-issue-labels.sh --add-label LABEL --remove-label LABEL` — add or remove labels (issue number is read from the workflow event) | |
| 24 | 24 | |
| 25 | 25 | TASK: |
| 26 | 26 | |
| @@ -48,15 +48,15 @@ | ||
| 48 | 48 | The goal is to avoid issues lingering without a clear next step. |
| 49 | 49 | |
| 50 | 50 | 7. Apply all selected labels: |
| 51 | - `./scripts/edit-issue-labels.sh --issue ISSUE_NUMBER --add-label "label1" --add-label "label2"` | |
| 51 | + `./scripts/edit-issue-labels.sh --add-label "label1" --add-label "label2"` | |
| 52 | 52 | |
| 53 | 53 | **If EVENT is "issue_comment" (comment on existing issue):** |
| 54 | 54 | |
| 55 | 55 | 4. Evaluate lifecycle labels based on the full conversation: |
| 56 | 56 | - If the issue has `stale` or `autoclose`, remove the label — a new human comment means the issue is still active: |
| 57 | - `./scripts/edit-issue-labels.sh --issue ISSUE_NUMBER --remove-label "stale" --remove-label "autoclose"` | |
| 57 | + `./scripts/edit-issue-labels.sh --remove-label "stale" --remove-label "autoclose"` | |
| 58 | 58 | - If the issue has `needs-repro` or `needs-info` and the missing information has now been provided, remove the label: |
| 59 | - `./scripts/edit-issue-labels.sh --issue ISSUE_NUMBER --remove-label "needs-repro"` | |
| 59 | + `./scripts/edit-issue-labels.sh --remove-label "needs-repro"` | |
| 60 | 60 | - If the issue doesn't have lifecycle labels but clearly needs them (e.g., a maintainer asked for repro steps or more details), add the appropriate label. |
| 61 | 61 | - Comments like "+1", "me too", "same here", or emoji reactions are NOT the missing information. Only remove `needs-repro` or `needs-info` when substantive details are actually provided. |
| 62 | 62 | - Do NOT add or remove category labels (bug, enhancement, etc.) on comment events. |
| @@ -26,6 +26,7 @@ | ||
| 26 | 26 | uses: anthropics/claude-code-action@v1 |
| 27 | 27 | env: |
| 28 | 28 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + CLAUDE_CODE_SCRIPT_CAPS: '{"comment-on-duplicates.sh":1}' | |
| 29 | 30 | with: |
| 30 | 31 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 31 | 32 | allowed_non_write_users: "*" |
| @@ -29,6 +29,7 @@ | ||
| 29 | 29 | env: |
| 30 | 30 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | 31 | GH_REPO: ${{ github.repository }} |
| 32 | + CLAUDE_CODE_SCRIPT_CAPS: '{"edit-issue-labels.sh":2}' | |
| 32 | 33 | with: |
| 33 | 34 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 34 | 35 | allowed_non_write_users: "*" |
| @@ -1,22 +1,28 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | 2 | # |
| 3 | 3 | # Comments on a GitHub issue with a list of potential duplicates. |
| 4 | -# Usage: ./comment-on-duplicates.sh --base-issue 123 --potential-duplicates 456 789 101 | |
| 4 | +# Usage: ./comment-on-duplicates.sh --potential-duplicates 456 789 101 | |
| 5 | 5 | # |
| 6 | +# The base issue number is read from the workflow event payload. | |
| 7 | +# | |
| 6 | 8 | |
| 7 | 9 | set -euo pipefail |
| 8 | 10 | |
| 9 | 11 | REPO="anthropics/claude-code" |
| 10 | -BASE_ISSUE="" | |
| 12 | + | |
| 13 | +# Read from event payload so the issue number is bound to the triggering event. | |
| 14 | +# Falls back to workflow_dispatch inputs for manual runs. | |
| 15 | +BASE_ISSUE=$(jq -r '.issue.number // .inputs.issue_number // empty' "${GITHUB_EVENT_PATH:?GITHUB_EVENT_PATH not set}") | |
| 16 | +if ! [[ "$BASE_ISSUE" =~ ^[0-9]+$ ]]; then | |
| 17 | + echo "Error: no issue number in event payload" >&2 | |
| 18 | + exit 1 | |
| 19 | +fi | |
| 20 | + | |
| 11 | 21 | DUPLICATES=() |
| 12 | 22 | |
| 13 | 23 | # Parse arguments |
| 14 | 24 | while [[ $# -gt 0 ]]; do |
| 15 | 25 | case $1 in |
| 16 | - --base-issue) | |
| 17 | - BASE_ISSUE="$2" | |
| 18 | - shift 2 | |
| 19 | - ;; | |
| 20 | 26 | --potential-duplicates) |
| 21 | 27 | shift |
| 22 | 28 | while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do |
| @@ -25,23 +31,12 @@ | ||
| 25 | 31 | done |
| 26 | 32 | ;; |
| 27 | 33 | *) |
| 28 | - echo "Unknown option: $1" >&2 | |
| 34 | + echo "Error: unknown argument (only --potential-duplicates is accepted)" >&2 | |
| 29 | 35 | exit 1 |
| 30 | 36 | ;; |
| 31 | 37 | esac |
| 32 | 38 | done |
| 33 | 39 | |
| 34 | -# Validate base issue | |
| 35 | -if [[ -z "$BASE_ISSUE" ]]; then | |
| 36 | - echo "Error: --base-issue is required" >&2 | |
| 37 | - exit 1 | |
| 38 | -fi | |
| 39 | - | |
| 40 | -if ! [[ "$BASE_ISSUE" =~ ^[0-9]+$ ]]; then | |
| 41 | - echo "Error: --base-issue must be a number, got: $BASE_ISSUE" >&2 | |
| 42 | - exit 1 | |
| 43 | -fi | |
| 44 | - | |
| 45 | 40 | # Validate duplicates |
| 46 | 41 | if [[ ${#DUPLICATES[@]} -eq 0 ]]; then |
| 47 | 42 | echo "Error: --potential-duplicates requires at least one issue number" >&2 |
| @@ -1,22 +1,27 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | 2 | # |
| 3 | 3 | # Edits labels on a GitHub issue. |
| 4 | -# Usage: ./edit-issue-labels.sh --issue 123 --add-label bug --add-label needs-triage --remove-label untriaged | |
| 4 | +# Usage: ./edit-issue-labels.sh --add-label bug --add-label needs-triage --remove-label untriaged | |
| 5 | 5 | # |
| 6 | +# The issue number is read from the workflow event payload. | |
| 7 | +# | |
| 6 | 8 | |
| 7 | 9 | set -euo pipefail |
| 8 | 10 | |
| 9 | -ISSUE="" | |
| 11 | +# Read from event payload so the issue number is bound to the triggering event. | |
| 12 | +# Falls back to workflow_dispatch inputs for manual runs. | |
| 13 | +ISSUE=$(jq -r '.issue.number // .inputs.issue_number // empty' "${GITHUB_EVENT_PATH:?GITHUB_EVENT_PATH not set}") | |
| 14 | +if ! [[ "$ISSUE" =~ ^[0-9]+$ ]]; then | |
| 15 | + echo "Error: no issue number in event payload" >&2 | |
| 16 | + exit 1 | |
| 17 | +fi | |
| 18 | + | |
| 10 | 19 | ADD_LABELS=() |
| 11 | 20 | REMOVE_LABELS=() |
| 12 | 21 | |
| 13 | 22 | # Parse arguments |
| 14 | 23 | while [[ $# -gt 0 ]]; do |
| 15 | 24 | case $1 in |
| 16 | - --issue) | |
| 17 | - ISSUE="$2" | |
| 18 | - shift 2 | |
| 19 | - ;; | |
| 20 | 25 | --add-label) |
| 21 | 26 | ADD_LABELS+=("$2") |
| 22 | 27 | shift 2 |
| @@ -26,20 +31,12 @@ | ||
| 26 | 31 | shift 2 |
| 27 | 32 | ;; |
| 28 | 33 | *) |
| 34 | + echo "Error: unknown argument (only --add-label and --remove-label are accepted)" >&2 | |
| 29 | 35 | exit 1 |
| 30 | 36 | ;; |
| 31 | 37 | esac |
| 32 | 38 | done |
| 33 | 39 | |
| 34 | -# Validate issue number | |
| 35 | -if [[ -z "$ISSUE" ]]; then | |
| 36 | - exit 1 | |
| 37 | -fi | |
| 38 | - | |
| 39 | -if ! [[ "$ISSUE" =~ ^[0-9]+$ ]]; then | |
| 40 | - exit 1 | |
| 41 | -fi | |
| 42 | - | |
| 43 | 40 | if [[ ${#ADD_LABELS[@]} -eq 0 && ${#REMOVE_LABELS[@]} -eq 0 ]]; then |
| 44 | 41 | exit 1 |
| 45 | 42 | fi |