From 1cf23c34e7e0124a5096ef7b48682b83d7a9fa1a Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Wed, 20 Aug 2025 17:35:00 +0800 Subject: [PATCH 1/3] fix: workflow automated issue triage --- .../gemini-automated-issue-triage.yml | 155 +----------------- 1 file changed, 1 insertion(+), 154 deletions(-) diff --git a/.github/workflows/gemini-automated-issue-triage.yml b/.github/workflows/gemini-automated-issue-triage.yml index b9343033..bb22e65b 100644 --- a/.github/workflows/gemini-automated-issue-triage.yml +++ b/.github/workflows/gemini-automated-issue-triage.yml @@ -34,13 +34,6 @@ jobs: triage-issue: timeout-minutes: 5 if: ${{ github.repository == 'QwenLM/qwen-code' }} - permissions: - issues: write - contents: read - id-token: write - concurrency: - group: ${{ github.workflow }}-${{ github.event.issue.number }} - cancel-in-progress: true runs-on: ubuntu-latest steps: - name: Run Qwen Issue Triage @@ -177,151 +170,5 @@ jobs: owner: '${{ github.repository }}'.split('/')[0], repo: '${{ github.repository }}'.split('/')[1], issue_number: '${{ github.event.issue.number }}', - body: 'There is a problem with the Gemini CLI issue triaging. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.' + body: 'There is a problem with the Qwen Code issue triaging. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.' }) - - deduplicate-issues: - if: > - github.repository == 'google-gemini/gemini-cli' && - vars.TRIAGE_DEDUPLICATE_ISSUES != '' && - (github.event_name == 'issues' || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'issue_comment' && - contains(github.event.comment.body, '@gemini-cli /deduplicate') && - (github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'COLLABORATOR'))) - - timeout-minutes: 20 - runs-on: 'ubuntu-latest' - steps: - - name: 'Checkout repository' - uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' - - - name: 'Generate GitHub App Token' - id: 'generate_token' - uses: 'actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e' - with: - app-id: '${{ secrets.APP_ID }}' - private-key: '${{ secrets.PRIVATE_KEY }}' - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Run Gemini Issue Deduplication' - uses: 'google-github-actions/run-gemini-cli@20351b5ea2b4179431f1ae8918a246a0808f8747' - id: 'gemini_issue_deduplication' - env: - GITHUB_TOKEN: '${{ steps.generate_token.outputs.token }}' - ISSUE_TITLE: '${{ github.event.issue.title }}' - ISSUE_BODY: '${{ github.event.issue.body }}' - ISSUE_NUMBER: '${{ github.event.issue.number }}' - REPOSITORY: '${{ github.repository }}' - FIRESTORE_PROJECT: '${{ vars.FIRESTORE_PROJECT }}' - with: - gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}' - gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}' - gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}' - gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' - gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' - use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' - use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' - settings: |- - { - "mcpServers": { - "issue_deduplication": { - "command": "docker", - "args": [ - "run", - "-i", - "--rm", - "--network", "host", - "-e", "GITHUB_TOKEN", - "-e", "GEMINI_API_KEY", - "-e", "DATABASE_TYPE", - "-e", "FIRESTORE_DATABASE_ID", - "-e", "GCP_PROJECT", - "-e", "GOOGLE_APPLICATION_CREDENTIALS=/app/gcp-credentials.json", - "-v", "${GOOGLE_APPLICATION_CREDENTIALS}:/app/gcp-credentials.json", - "ghcr.io/google-gemini/gemini-cli-issue-triage@sha256:e3de1523f6c83aabb3c54b76d08940a2bf42febcb789dd2da6f95169641f94d3" - ], - "env": { - "GITHUB_TOKEN": "${GITHUB_TOKEN}", - "GEMINI_API_KEY": "${{ secrets.GEMINI_API_KEY }}", - "DATABASE_TYPE":"firestore", - "GCP_PROJECT": "${FIRESTORE_PROJECT}", - "FIRESTORE_DATABASE_ID": "(default)", - "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}" - }, - "enabled": true, - "timeout": 600000 - } - }, - "maxSessionTurns": 25, - "coreTools": [ - "run_shell_command(echo)", - "run_shell_command(gh issue comment)", - "run_shell_command(gh issue view)", - "run_shell_command(gh issue edit)" - ], - "telemetry": { - "enabled": true, - "target": "gcp" - } - } - prompt: |- - ## Role - You are an issue de-duplication assistant. Your goal is to find - duplicate issues, label the current issue as a duplicate, and notify - the user by commenting on the current issue, while avoiding - duplicate comments. - ## Steps - 1. **Find Potential Duplicates:** - - The repository is ${{ github.repository }} and the issue number is ${{ github.event.issue.number }}. - - Use the `duplicates` tool with the `repo` and `issue_number` to find potential duplicates for the current issue. Do not use the `threshold` parameter. - - If no duplicates are found, you are done. - - Print the JSON output from the `duplicates` tool to the logs. - 2. **Refine Duplicates List (if necessary):** - - If the `duplicates` tool returns between 1 and 14 results, you must refine the list. - - For each potential duplicate issue, run `gh issue view --json title,body,comments` to fetch its content. - - Also fetch the content of the original issue: `gh issue view "${ISSUE_NUMBER}" --json title,body,comments`. - - Carefully analyze the content (title, body, comments) of the original issue and all potential duplicates. - - It is very important if the comments on either issue mention that they are not duplicates of each other, to treat them as not duplicates. - - Based on your analysis, create a final list containing only the issues you are highly confident are actual duplicates. - - If your final list is empty, you are done. - - Print to the logs if you omitted any potential duplicates based on your analysis. - - If the `duplicates` tool returned 15+ results, use the top 15 matches (based on descending similarity score value) to perform this step. - 3. **Format Final Duplicates List:** - Format the final list of duplicates into a markdown string. - The format should be: - "Found possible duplicate issues:\n\n- #${issue_number}\n\nIf you believe this is not a duplicate, please remove the `status/possible-duplicate` label." - Add an HTML comment to the end for identification: `` - 4. **Check for Existing Comment:** - - Run `gh issue view "${ISSUE_NUMBER}" --json comments` to get all - comments on the issue. - - Look for a comment made by a bot (the author's login often ends in `[bot]`) that contains ``. - - If you find such a comment, store its `id` and `body`. - 5. **Decide Action:** - - **If an existing comment is found:** - - Compare the new list of duplicate issues with the list from the existing comment's body. - - If they are the same, do nothing. - - If they are different, edit the existing comment. Use - `gh issue comment "${ISSUE_NUMBER}" --edit-comment --body "..."`. - The new body should be the new list of duplicates, but with the header "Found possible duplicate issues (updated):". - - **If no existing comment is found:** - - Create a new comment with the list of duplicates. - - Use `gh issue comment "${ISSUE_NUMBER}" --body "..."`. - 6. **Add Duplicate Label:** - - If you created or updated a comment in the previous step, add the `duplicate` label to the current issue. - - Use `gh issue edit "${ISSUE_NUMBER}" --add-label "status/possible-duplicate"`. - ## Guidelines - - Only use the `duplicates` and `run_shell_command` tools. - - The `run_shell_command` tool can be used with `gh issue view`, `gh issue comment`, and `gh issue edit`. - - Do not download or read media files like images, videos, or links. The `--json` flag for `gh issue view` will prevent this. - - Do not modify the issue content or status. - - Only comment on and label the current issue. - - Reference all shell variables as "${VAR}" (with quotes and braces). From 201b476a3e2e3163bd9ff314c344aa6295fa0293 Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Wed, 20 Aug 2025 17:52:25 +0800 Subject: [PATCH 2/3] fix: workflow automated issue triage --- .github/workflows/gemini-automated-issue-triage.yml | 3 ++- .github/workflows/gemini-scheduled-issue-triage.yml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gemini-automated-issue-triage.yml b/.github/workflows/gemini-automated-issue-triage.yml index bb22e65b..3d711264 100644 --- a/.github/workflows/gemini-automated-issue-triage.yml +++ b/.github/workflows/gemini-automated-issue-triage.yml @@ -43,8 +43,9 @@ jobs: ISSUE_TITLE: ${{ github.event.issue.title }} ISSUE_BODY: ${{ github.event.issue.body }} with: - version: 0.0.7 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} + OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }} settings_json: | { "maxSessionTurns": 25, diff --git a/.github/workflows/gemini-scheduled-issue-triage.yml b/.github/workflows/gemini-scheduled-issue-triage.yml index ac698dd7..ca11b308 100644 --- a/.github/workflows/gemini-scheduled-issue-triage.yml +++ b/.github/workflows/gemini-scheduled-issue-triage.yml @@ -60,7 +60,6 @@ jobs: ISSUES_TO_TRIAGE: ${{ steps.find_issues.outputs.issues_to_triage }} REPOSITORY: ${{ github.repository }} with: - version: 0.0.7 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }} From 9a28f04acedc38dde6767f43a6c325d681507fee Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Wed, 20 Aug 2025 19:41:17 +0800 Subject: [PATCH 3/3] chore: update issue triage prompt --- .github/workflows/gemini-automated-issue-triage.yml | 2 +- .github/workflows/gemini-scheduled-issue-triage.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gemini-automated-issue-triage.yml b/.github/workflows/gemini-automated-issue-triage.yml index 3d711264..cc73d9d0 100644 --- a/.github/workflows/gemini-automated-issue-triage.yml +++ b/.github/workflows/gemini-automated-issue-triage.yml @@ -66,7 +66,7 @@ jobs: ## Steps 1. Run: `gh label list --repo ${{ github.repository }} --limit 100` to get all available labels. - 2. Review the issue title and body provided in the environment variables: "${ISSUE_TITLE}" and "${ISSUE_BODY}". + 2. Use right tool to review the issue title and body provided in the environment variables: "${ISSUE_TITLE}" and "${ISSUE_BODY}". 3. Ignore any existing priorities or tags on the issue. Just report your findings. 4. Select the most relevant labels from the existing labels, focusing on kind/*, area/*, sub-area/* and priority/*. For area/* and kind/* limit yourself to only the single most applicable label in each case. 6. Apply the selected labels to this issue using: `gh issue edit ${{ github.event.issue.number }} --repo ${{ github.repository }} --add-label "label1,label2"`. diff --git a/.github/workflows/gemini-scheduled-issue-triage.yml b/.github/workflows/gemini-scheduled-issue-triage.yml index ca11b308..66c0167b 100644 --- a/.github/workflows/gemini-scheduled-issue-triage.yml +++ b/.github/workflows/gemini-scheduled-issue-triage.yml @@ -85,7 +85,7 @@ jobs: ## Steps 1. Run: `gh label list --repo ${{ github.repository }} --limit 100` to get all available labels. - 2. Check environment variable for issues to triage: $ISSUES_TO_TRIAGE (JSON array of issues) + 2. Use right tool to check environment variable for issues to triage: $ISSUES_TO_TRIAGE (JSON array of issues) 3. Review the issue title, body and any comments provided in the environment variables. 4. Ignore any existing priorities or tags on the issue. 5. Select the most relevant labels from the existing labels, focusing on kind/*, area/*, sub-area/* and priority/*.