diff --git a/templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml b/templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml index c7087db26..dc48a4ec7 100644 --- a/templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml +++ b/templates/consumer-repo/.github/workflows/agents-issue-optimizer.yml @@ -136,8 +136,10 @@ jobs: cat /tmp/suggestions.json > /tmp/comment.md } - # Post comment - gh issue comment "${ISSUE_NUMBER}" --body-file /tmp/comment.md + # Post comment to the consumer repo (not Workflows repo) + gh issue comment "${ISSUE_NUMBER}" \ + --repo "${{ github.repository }}" \ + --body-file /tmp/comment.md echo "Analysis complete. Review suggestions and add" echo "'agents:apply-suggestions' label to apply." @@ -196,7 +198,9 @@ jobs: PY if [[ -f /tmp/dedup_comment.md ]]; then - gh issue comment "${ISSUE_NUMBER}" --body-file /tmp/dedup_comment.md || true + gh issue comment "${ISSUE_NUMBER}" \ + --repo "${{ github.repository }}" \ + --body-file /tmp/dedup_comment.md || true else echo "No likely duplicates detected." fi @@ -252,7 +256,9 @@ jobs: " || exit 1 # Update issue body - gh issue edit "${ISSUE_NUMBER}" --body-file /tmp/updated_body.md + gh issue edit "${ISSUE_NUMBER}" \ + --repo "${{ github.repository }}" \ + --body-file /tmp/updated_body.md echo "Issue body updated with applied suggestions" @@ -289,7 +295,9 @@ jobs: " || exit 1 # Update issue body with formatted version - gh issue edit "${ISSUE_NUMBER}" --body-file /tmp/formatted_body.md + gh issue edit "${ISSUE_NUMBER}" \ + --repo "${{ github.repository }}" \ + --body-file /tmp/formatted_body.md echo "Issue body updated with formatted structure" @@ -299,16 +307,22 @@ jobs: GH_TOKEN: ${{ github.token }} ISSUE_NUMBER: ${{ steps.check.outputs.issue_number }} PHASE: ${{ steps.check.outputs.phase }} + REPO: ${{ github.repository }} run: | if [[ "$PHASE" == "apply" ]]; then # Remove both optimization labels and add formatted label - gh issue edit "${ISSUE_NUMBER}" --remove-label "agents:optimize" || true - gh issue edit "${ISSUE_NUMBER}" --remove-label "agents:apply-suggestions" - gh issue edit "${ISSUE_NUMBER}" --add-label "agents:formatted" + gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ + --remove-label "agents:optimize" || true + gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ + --remove-label "agents:apply-suggestions" + gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ + --add-label "agents:formatted" echo "Labels updated: removed optimize/apply-suggestions, added formatted" elif [[ "$PHASE" == "format" ]]; then # Remove format trigger label and add formatted result label - gh issue edit "${ISSUE_NUMBER}" --remove-label "agents:format" - gh issue edit "${ISSUE_NUMBER}" --add-label "agents:formatted" + gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ + --remove-label "agents:format" + gh issue edit "${ISSUE_NUMBER}" --repo "${REPO}" \ + --add-label "agents:formatted" echo "Labels updated: removed format, added formatted" fi