| name: duplicate-issues |
|
|
| on: |
| issues: |
| types: [opened, edited] |
|
|
| jobs: |
| check-duplicates: |
| if: github.event.action == 'opened' |
| runs-on: blacksmith-4vcpu-ubuntu-2404 |
| permissions: |
| contents: read |
| issues: write |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| with: |
| fetch-depth: 1 |
|
|
| - name: Check exempt issue author |
| id: author |
| run: | |
| LOGIN="${{ github.event.issue.user.login }}" |
| ASSOCIATION="${{ github.event.issue.author_association }}" |
| |
| if [ "$LOGIN" = "opencode-agent[bot]" ] || |
| [ "$ASSOCIATION" = "OWNER" ] || |
| [ "$ASSOCIATION" = "MEMBER" ] || |
| grep -qxiF "$LOGIN" .github/TEAM_MEMBERS; then |
| echo "skip=true" >> "$GITHUB_OUTPUT" |
| echo "Skipping issue automation for exempt author: $LOGIN ($ASSOCIATION)" |
| else |
| echo "skip=false" >> "$GITHUB_OUTPUT" |
| fi |
|
|
| - uses: ./.github/actions/setup-bun |
| if: steps.author.outputs.skip != 'true' |
|
|
| - name: Install opencode |
| if: steps.author.outputs.skip != 'true' |
| run: curl -fsSL https://opencode.ai/install | bash |
|
|
| - name: Check duplicates and compliance |
| if: steps.author.outputs.skip != 'true' |
| env: |
| OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| OPENCODE_PERMISSION: | |
| { |
| "bash": { |
| "*": "deny", |
| "gh issue*": "allow" |
| }, |
| "webfetch": "deny" |
| } |
| run: | |
| opencode run -m opencode/claude-sonnet-4-6 "A new issue has been created: |
| |
| Issue number: ${{ github.event.issue.number }} |
| Issue author association: ${{ github.event.issue.author_association }} |
|
|
| Lookup this issue with gh issue view ${{ github.event.issue.number }}. |
|
|
| You have TWO tasks. Perform both, then post a SINGLE comment (if needed). |
|
|
| --- |
|
|
| TASK 1: CONTRIBUTING GUIDELINES COMPLIANCE CHECK |
|
|
| Check whether the issue follows our contributing guidelines and issue templates. |
|
|
| If the issue author association is OWNER or MEMBER, skip this compliance check. Do not add the needs:compliance label for organization-owned issues. |
|
|
| This project has three issue templates that every issue MUST use one of: |
|
|
| 1. Bug Report - requires a Description field with real content |
| 2. Feature Request - requires a verification checkbox and description, title should start with [FEATURE]: |
| 3. Question - requires the Question field with real content |
|
|
| Additionally check: |
| - No AI-generated walls of text (long, AI-generated descriptions are not acceptable) |
| - The issue has real content, not just template placeholder text left unchanged |
| - Bug reports should include some context about how to reproduce |
| - Feature requests should explain the problem or need |
| - We want to push for having the user provide system description & information |
|
|
| Do NOT be nitpicky about optional fields. Only flag real problems like: no template used, required fields empty or placeholder text only, obviously AI-generated walls of text, or completely empty/nonsensical content. |
|
|
| --- |
|
|
| TASK 2: DUPLICATE CHECK |
|
|
| Search through existing issues (excluding |
| Consider: |
| 1. Similar titles or descriptions |
| 2. Same error messages or symptoms |
| 3. Related functionality or components |
| 4. Similar feature requests |
|
|
| Additionally, if the issue mentions keybinds, keyboard shortcuts, or key bindings, note the pinned keybinds issue |
|
|
| --- |
|
|
| POSTING YOUR COMMENT: |
|
|
| Based on your findings, post a SINGLE comment on issue |
|
|
| If the issue is NOT compliant and the author association is not OWNER or MEMBER, start the comment with: |
| <!-- issue-compliance --> |
| Then explain what needs to be fixed and that they have 2 hours to edit the issue before it is automatically closed. Also add the label needs:compliance to the issue using: gh issue edit ${{ github.event.issue.number }} --add-label needs:compliance |
|
|
| If duplicates were found, include a section about potential duplicates with links. |
|
|
| If the issue mentions keybinds/keyboard shortcuts, include a note about |
|
|
| If the issue IS compliant AND no duplicates were found AND no keybind reference, do NOT comment at all. |
|
|
| Use this format for the comment: |
|
|
| [If not compliant:] |
| <!-- issue-compliance --> |
| This issue doesn't fully meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md). |
|
|
| **What needs to be fixed:** |
| - [specific reasons] |
|
|
| Please edit this issue to address the above within **2 hours**, or it will be automatically closed. |
|
|
| [If duplicates found, add:] |
| --- |
| This issue might be a duplicate of existing issues. Please check: |
| - |
|
|
| [If keybind-related, add:] |
| For keybind-related issues, please also check our pinned keybinds documentation: |
|
|
| [End with if not compliant:] |
| If you believe this was flagged incorrectly, please let a maintainer know. |
|
|
| Remember: post at most ONE comment combining all findings. If everything is fine, post nothing." |
|
|
| recheck-compliance: |
| if: github.event.action == 'edited' && contains(github.event.issue.labels.*.name, 'needs:compliance') |
| runs-on: blacksmith-4vcpu-ubuntu-2404 |
| permissions: |
| contents: read |
| issues: write |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| with: |
| fetch-depth: 1 |
|
|
| - name: Check exempt issue author |
| id: author |
| run: | |
| LOGIN="${{ github.event.issue.user.login }}" |
| ASSOCIATION="${{ github.event.issue.author_association }}" |
| |
| if [ "$LOGIN" = "opencode-agent[bot]" ] || |
| [ "$ASSOCIATION" = "OWNER" ] || |
| [ "$ASSOCIATION" = "MEMBER" ] || |
| grep -qxiF "$LOGIN" .github/TEAM_MEMBERS; then |
| echo "skip=true" >> "$GITHUB_OUTPUT" |
| echo "Skipping issue automation for exempt author: $LOGIN ($ASSOCIATION)" |
| else |
| echo "skip=false" >> "$GITHUB_OUTPUT" |
| fi |
|
|
| - uses: ./.github/actions/setup-bun |
| if: steps.author.outputs.skip != 'true' |
|
|
| - name: Install opencode |
| if: steps.author.outputs.skip != 'true' |
| run: curl -fsSL https://opencode.ai/install | bash |
|
|
| - name: Recheck compliance |
| if: steps.author.outputs.skip != 'true' |
| env: |
| OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| OPENCODE_PERMISSION: | |
| { |
| "bash": { |
| "*": "deny", |
| "gh issue*": "allow" |
| }, |
| "webfetch": "deny" |
| } |
| run: | |
| opencode run -m opencode/claude-sonnet-4-6 "Issue #${{ github.event.issue.number }} was previously flagged as non-compliant and has been edited. |
| Issue author association: ${{ github.event.issue.author_association }} |
| |
| Lookup this issue with gh issue view ${{ github.event.issue.number }}. |
|
|
| If the issue author association is OWNER or MEMBER, remove the needs:compliance label if present, delete the previous compliance comment if present, and do not post a new comment. |
|
|
| Re-check whether the issue now follows our contributing guidelines and issue templates. |
|
|
| This project has three issue templates that every issue MUST use one of: |
|
|
| 1. Bug Report - requires a Description field with real content |
| 2. Feature Request - requires a verification checkbox and description, title should start with [FEATURE]: |
| 3. Question - requires the Question field with real content |
|
|
| Additionally check: |
| - No AI-generated walls of text (long, AI-generated descriptions are not acceptable) |
| - The issue has real content, not just template placeholder text left unchanged |
| - Bug reports should include some context about how to reproduce |
| - Feature requests should explain the problem or need |
| - We want to push for having the user provide system description & information |
|
|
| Do NOT be nitpicky about optional fields. Only flag real problems like: no template used, required fields empty or placeholder text only, obviously AI-generated walls of text, or completely empty/nonsensical content. |
|
|
| If the issue is NOW compliant: |
| 1. Remove the needs:compliance label: gh issue edit ${{ github.event.issue.number }} --remove-label needs:compliance |
| 2. Find and delete the previous compliance comment (the one containing <!-- issue-compliance -->) using: gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments --jq '.[] | select(.body | contains(\"<!-- issue-compliance -->\")) | .id' then delete it with: gh api -X DELETE repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments/{id} |
| 3. Post a short comment thanking them for updating the issue. |
|
|
| If the issue is STILL not compliant: |
| Post a comment explaining what still needs to be fixed. Keep the needs:compliance label." |
|
|