Skip to content

Commit 639d1dd

Browse files
authored
chore: add compliance checks for issues and PRs with recheck on edit (anomalyco#14170)
1 parent 7033b4d commit 639d1dd

File tree

5 files changed

+323
-25
lines changed

5 files changed

+323
-25
lines changed

.github/TEAM_MEMBERS

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
adamdotdevin
2+
Brendonovich
3+
fwang
4+
Hona
5+
iamdavidhill
6+
jayair
7+
jlongster
8+
kitlangton
9+
kommander
10+
MrMushrooooom
11+
nexxeln
12+
R44VC0RP
13+
rekram1-node
14+
RhysSullivan
15+
thdxr

.github/pull_request_template.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
### Issue for this PR
2+
3+
Closes #
4+
5+
### Type of change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature
9+
- [ ] Refactor / code improvement
10+
- [ ] Documentation
11+
112
### What does this PR do?
213

3-
Please provide a description of the issue (if there is one), the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
14+
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
415

516
**If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!**
617

718
### How did you verify your code works?
19+
20+
### Screenshots / recordings
21+
22+
_If this is a UI change, please include a screenshot or recording._
23+
24+
### Checklist
25+
26+
- [ ] I have tested my changes locally
27+
- [ ] I have not included unrelated changes in this PR
28+
29+
_If you do not follow this template your PR will be automatically rejected._

.github/workflows/duplicate-issues.yml

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ name: duplicate-issues
22

33
on:
44
issues:
5-
types: [opened]
5+
types: [opened, edited]
66

77
jobs:
88
check-duplicates:
9+
if: github.event.action == 'opened'
910
runs-on: blacksmith-4vcpu-ubuntu-2404
1011
permissions:
1112
contents: read
@@ -34,7 +35,7 @@ jobs:
3435
"webfetch": "deny"
3536
}
3637
run: |
37-
opencode run -m opencode/claude-haiku-4-5 "A new issue has been created:
38+
opencode run -m opencode/claude-sonnet-4-6 "A new issue has been created:
3839
3940
Issue number: ${{ github.event.issue.number }}
4041
@@ -115,3 +116,62 @@ jobs:
115116
If you believe this was flagged incorrectly, please let a maintainer know.
116117
117118
Remember: post at most ONE comment combining all findings. If everything is fine, post nothing."
119+
120+
recheck-compliance:
121+
if: github.event.action == 'edited' && contains(github.event.issue.labels.*.name, 'needs:compliance')
122+
runs-on: blacksmith-4vcpu-ubuntu-2404
123+
permissions:
124+
contents: read
125+
issues: write
126+
steps:
127+
- name: Checkout repository
128+
uses: actions/checkout@v4
129+
with:
130+
fetch-depth: 1
131+
132+
- uses: ./.github/actions/setup-bun
133+
134+
- name: Install opencode
135+
run: curl -fsSL https://opencode.ai/install | bash
136+
137+
- name: Recheck compliance
138+
env:
139+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
OPENCODE_PERMISSION: |
142+
{
143+
"bash": {
144+
"*": "deny",
145+
"gh issue*": "allow"
146+
},
147+
"webfetch": "deny"
148+
}
149+
run: |
150+
opencode run -m opencode/claude-sonnet-4-6 "Issue #${{ github.event.issue.number }} was previously flagged as non-compliant and has been edited.
151+
152+
Lookup this issue with gh issue view ${{ github.event.issue.number }}.
153+
154+
Re-check whether the issue now follows our contributing guidelines and issue templates.
155+
156+
This project has three issue templates that every issue MUST use one of:
157+
158+
1. Bug Report - requires a Description field with real content
159+
2. Feature Request - requires a verification checkbox and description, title should start with [FEATURE]:
160+
3. Question - requires the Question field with real content
161+
162+
Additionally check:
163+
- No AI-generated walls of text (long, AI-generated descriptions are not acceptable)
164+
- The issue has real content, not just template placeholder text left unchanged
165+
- Bug reports should include some context about how to reproduce
166+
- Feature requests should explain the problem or need
167+
- We want to push for having the user provide system description & information
168+
169+
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.
170+
171+
If the issue is NOW compliant:
172+
1. Remove the needs:compliance label: gh issue edit ${{ github.event.issue.number }} --remove-label needs:compliance
173+
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}
174+
3. Post a short comment thanking them for updating the issue.
175+
176+
If the issue is STILL not compliant:
177+
Post a comment explaining what still needs to be fixed. Keep the needs:compliance label."

.github/workflows/pr-management.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@ on:
66

77
jobs:
88
check-duplicates:
9-
if: |
10-
github.event.pull_request.user.login != 'actions-user' &&
11-
github.event.pull_request.user.login != 'opencode' &&
12-
github.event.pull_request.user.login != 'rekram1-node' &&
13-
github.event.pull_request.user.login != 'thdxr' &&
14-
github.event.pull_request.user.login != 'kommander' &&
15-
github.event.pull_request.user.login != 'jayair' &&
16-
github.event.pull_request.user.login != 'fwang' &&
17-
github.event.pull_request.user.login != 'adamdotdevin' &&
18-
github.event.pull_request.user.login != 'iamdavidhill' &&
19-
github.event.pull_request.user.login != 'opencode-agent[bot]'
209
runs-on: blacksmith-4vcpu-ubuntu-2404
2110
permissions:
2211
contents: read
@@ -27,16 +16,31 @@ jobs:
2716
with:
2817
fetch-depth: 1
2918

19+
- name: Check team membership
20+
id: team-check
21+
run: |
22+
LOGIN="${{ github.event.pull_request.user.login }}"
23+
if [ "$LOGIN" = "opencode-agent[bot]" ] || grep -qxF "$LOGIN" .github/TEAM_MEMBERS; then
24+
echo "is_team=true" >> "$GITHUB_OUTPUT"
25+
echo "Skipping: $LOGIN is a team member or bot"
26+
else
27+
echo "is_team=false" >> "$GITHUB_OUTPUT"
28+
fi
29+
3030
- name: Setup Bun
31+
if: steps.team-check.outputs.is_team != 'true'
3132
uses: ./.github/actions/setup-bun
3233

3334
- name: Install dependencies
35+
if: steps.team-check.outputs.is_team != 'true'
3436
run: bun install
3537

3638
- name: Install opencode
39+
if: steps.team-check.outputs.is_team != 'true'
3740
run: curl -fsSL https://opencode.ai/install | bash
3841

3942
- name: Build prompt
43+
if: steps.team-check.outputs.is_team != 'true'
4044
env:
4145
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4246
PR_NUMBER: ${{ github.event.pull_request.number }}
@@ -53,6 +57,7 @@ jobs:
5357
} > pr_info.txt
5458
5559
- name: Check for duplicate PRs
60+
if: steps.team-check.outputs.is_team != 'true'
5661
env:
5762
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
5863
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)