diff --git a/.github/agents/issuelens.agent.md b/.github/agents/issuelens.agent.md index 3723efc2..73d50f8b 100644 --- a/.github/agents/issuelens.agent.md +++ b/.github/agents/issuelens.agent.md @@ -40,7 +40,34 @@ The comment should include, in order: ``` -Post the comment on the issue using `github/add_issue_comment`. +Post the comment on the issue by writing and executing the following Python script inline. The script reads `GITHUB_TOKEN` (or `GITHUB_ACCESS_TOKEN`) from the environment. + +```python +import os, sys, requests + +def add_issue_comment(owner, repo, issue_number, body): + token = ( + os.environ.get("GITHUB_TOKEN") + or os.environ.get("GITHUB_ACCESS_TOKEN") + or os.environ.get("GITHUB_PAT") + ) + if not token: + print("❌ GitHub token not found. Set GITHUB_TOKEN, GITHUB_ACCESS_TOKEN, or GITHUB_PAT.", file=sys.stderr) + sys.exit(1) + url = f"https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}/comments" + headers = { + "Authorization": f"Bearer {token}", + "Accept": "application/vnd.github+json", + "X-GitHub-Api-Version": "2022-11-28", + } + response = requests.post(url, headers=headers, json={"body": body}) + response.raise_for_status() + result = response.json() + print(f"✅ Comment posted on issue #{issue_number}: {result['html_url']}") + +# Fill in owner, repo, issue_number, and body before running: +add_issue_comment("", "", , "") +``` ## Step 2: Label the Issue diff --git a/.github/skills/label-issue/SKILL.md b/.github/skills/label-issue/SKILL.md index 272340f1..bbbddeda 100644 --- a/.github/skills/label-issue/SKILL.md +++ b/.github/skills/label-issue/SKILL.md @@ -35,7 +35,7 @@ Fetch `.github/llms.md` from the target repository using GitHub MCP tools. The f For template format, see [references/label_instructions_template.md](references/label_instructions_template.md). -If `.github/label-instructions.md` is not found: +If `.github/llms.md` is not found: 1. Fetch the list of labels defined in the target repository using `github/list_labels` 2. Create a brief summary of available labels based on their names and descriptions 3. Use the summary to determine which labels best match the issue content @@ -103,8 +103,8 @@ Report the labeling decision with: The skill requires: -1. **GITHUB_ACCESS_TOKEN** or **GITHUB_PAT** environment variable with `repo` scope -2. **label-instructions.md** in target repository (optional but recommended) +1. **GITHUB_ACCESS_TOKEN** or **GITHUB_TOKEN** environment variable with `repo` scope +2. **.github/llms.md** in target repository (optional but recommended) ## Fallback Behavior diff --git a/.github/skills/label-issue/scripts/label_issue.py b/.github/skills/label-issue/scripts/label_issue.py index 5b7fcc36..b87756c0 100644 --- a/.github/skills/label-issue/scripts/label_issue.py +++ b/.github/skills/label-issue/scripts/label_issue.py @@ -17,10 +17,10 @@ def get_github_token() -> str: """Get GitHub token from environment variables.""" - token = os.environ.get("GITHUB_ACCESS_TOKEN") or os.environ.get("GITHUB_PAT") + token = os.environ.get("GITHUB_ACCESS_TOKEN") or os.environ.get("GITHUB_TOKEN") or os.environ.get("GITHUB_PAT") if not token: raise ValueError( - "GitHub token not found. Set GITHUB_ACCESS_TOKEN or GITHUB_PAT environment variable." + "GitHub token not found. Set GITHUB_ACCESS_TOKEN, GITHUB_TOKEN, or GITHUB_PAT environment variable." ) return token diff --git a/.github/workflows/issueLens-run.yml b/.github/workflows/issueLens-run.yml index 093fa2ec..15e2946e 100644 --- a/.github/workflows/issueLens-run.yml +++ b/.github/workflows/issueLens-run.yml @@ -10,6 +10,10 @@ on: required: true type: string +permissions: + issues: write + contents: read + jobs: run-issuelens: runs-on: ubuntu-latest @@ -54,6 +58,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} JAVATOOLING_INDEX_URL: ${{ secrets.JAVATOOLING_INDEX_URL }} MAILING_URL: ${{ secrets.MAILING_URL }} + REPORT_RECIPIENTS: ${{ secrets.REPORT_RECIPIENTS }} - name: Upload triage output uses: actions/upload-artifact@v4