duplicate-issues.yml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. name: duplicate-issues
  2. on:
  3. issues:
  4. types: [opened, edited]
  5. jobs:
  6. check-duplicates:
  7. if: github.event.action == 'opened'
  8. runs-on: blacksmith-4vcpu-ubuntu-2404
  9. permissions:
  10. contents: read
  11. issues: write
  12. steps:
  13. - name: Checkout repository
  14. uses: actions/checkout@v4
  15. with:
  16. fetch-depth: 1
  17. - uses: ./.github/actions/setup-bun
  18. - name: Install opencode
  19. run: curl -fsSL https://opencode.ai/install | bash
  20. - name: Check duplicates and compliance
  21. env:
  22. OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
  23. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  24. OPENCODE_PERMISSION: |
  25. {
  26. "bash": {
  27. "*": "deny",
  28. "gh issue*": "allow"
  29. },
  30. "webfetch": "deny"
  31. }
  32. run: |
  33. opencode run -m opencode/claude-sonnet-4-6 "A new issue has been created:
  34. Issue number: ${{ github.event.issue.number }}
  35. Lookup this issue with gh issue view ${{ github.event.issue.number }}.
  36. You have TWO tasks. Perform both, then post a SINGLE comment (if needed).
  37. ---
  38. TASK 1: CONTRIBUTING GUIDELINES COMPLIANCE CHECK
  39. Check whether the issue follows our contributing guidelines and issue templates.
  40. This project has three issue templates that every issue MUST use one of:
  41. 1. Bug Report - requires a Description field with real content
  42. 2. Feature Request - requires a verification checkbox and description, title should start with [FEATURE]:
  43. 3. Question - requires the Question field with real content
  44. Additionally check:
  45. - No AI-generated walls of text (long, AI-generated descriptions are not acceptable)
  46. - The issue has real content, not just template placeholder text left unchanged
  47. - Bug reports should include some context about how to reproduce
  48. - Feature requests should explain the problem or need
  49. - We want to push for having the user provide system description & information
  50. 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.
  51. ---
  52. TASK 2: DUPLICATE CHECK
  53. Search through existing issues (excluding #${{ github.event.issue.number }}) to find potential duplicates.
  54. Consider:
  55. 1. Similar titles or descriptions
  56. 2. Same error messages or symptoms
  57. 3. Related functionality or components
  58. 4. Similar feature requests
  59. Additionally, if the issue mentions keybinds, keyboard shortcuts, or key bindings, note the pinned keybinds issue #4997.
  60. ---
  61. POSTING YOUR COMMENT:
  62. Based on your findings, post a SINGLE comment on issue #${{ github.event.issue.number }}. Build the comment as follows:
  63. If the issue is NOT compliant, start the comment with:
  64. <!-- issue-compliance -->
  65. 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
  66. If duplicates were found, include a section about potential duplicates with links.
  67. If the issue mentions keybinds/keyboard shortcuts, include a note about #4997.
  68. If the issue IS compliant AND no duplicates were found AND no keybind reference, do NOT comment at all.
  69. Use this format for the comment:
  70. [If not compliant:]
  71. <!-- issue-compliance -->
  72. This issue doesn't fully meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md).
  73. **What needs to be fixed:**
  74. - [specific reasons]
  75. Please edit this issue to address the above within **2 hours**, or it will be automatically closed.
  76. [If duplicates found, add:]
  77. ---
  78. This issue might be a duplicate of existing issues. Please check:
  79. - #[issue_number]: [brief description of similarity]
  80. [If keybind-related, add:]
  81. For keybind-related issues, please also check our pinned keybinds documentation: #4997
  82. [End with if not compliant:]
  83. If you believe this was flagged incorrectly, please let a maintainer know.
  84. Remember: post at most ONE comment combining all findings. If everything is fine, post nothing."
  85. recheck-compliance:
  86. if: github.event.action == 'edited' && contains(github.event.issue.labels.*.name, 'needs:compliance')
  87. runs-on: blacksmith-4vcpu-ubuntu-2404
  88. permissions:
  89. contents: read
  90. issues: write
  91. steps:
  92. - name: Checkout repository
  93. uses: actions/checkout@v4
  94. with:
  95. fetch-depth: 1
  96. - uses: ./.github/actions/setup-bun
  97. - name: Install opencode
  98. run: curl -fsSL https://opencode.ai/install | bash
  99. - name: Recheck compliance
  100. env:
  101. OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
  102. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  103. OPENCODE_PERMISSION: |
  104. {
  105. "bash": {
  106. "*": "deny",
  107. "gh issue*": "allow"
  108. },
  109. "webfetch": "deny"
  110. }
  111. run: |
  112. opencode run -m opencode/claude-sonnet-4-6 "Issue #${{ github.event.issue.number }} was previously flagged as non-compliant and has been edited.
  113. Lookup this issue with gh issue view ${{ github.event.issue.number }}.
  114. Re-check whether the issue now follows our contributing guidelines and issue templates.
  115. This project has three issue templates that every issue MUST use one of:
  116. 1. Bug Report - requires a Description field with real content
  117. 2. Feature Request - requires a verification checkbox and description, title should start with [FEATURE]:
  118. 3. Question - requires the Question field with real content
  119. Additionally check:
  120. - No AI-generated walls of text (long, AI-generated descriptions are not acceptable)
  121. - The issue has real content, not just template placeholder text left unchanged
  122. - Bug reports should include some context about how to reproduce
  123. - Feature requests should explain the problem or need
  124. - We want to push for having the user provide system description & information
  125. 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.
  126. If the issue is NOW compliant:
  127. 1. Remove the needs:compliance label: gh issue edit ${{ github.event.issue.number }} --remove-label needs:compliance
  128. 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}
  129. 3. Post a short comment thanking them for updating the issue.
  130. If the issue is STILL not compliant:
  131. Post a comment explaining what still needs to be fixed. Keep the needs:compliance label."