Skip to content

Commit a32cdde

Browse files
ci: label issues from vouched and denounced authors, denounce coygeek (#36021)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 15d1ef5 commit a32cdde

3 files changed

Lines changed: 81 additions & 3 deletions

File tree

‎.github/VOUCHED.td‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ github:btsouth
2222
github:cestercian
2323
github:chrisdeeming
2424
github:chuks-qua
25+
-github:coygeek Filed over 270 automated issues, about 50 a day at peak, far past what maintainers can triage
2526
github:cursoragent
2627
github:D3OXY
2728
github:dbalders

‎.github/workflows/issue-vouch.yml‎

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Issue Vouch
2+
3+
on:
4+
issues:
5+
types: [opened, reopened]
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- .github/VOUCHED.td
11+
- .github/workflows/issue-vouch.yml
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
issues: write
17+
18+
concurrency:
19+
group: issue-vouch-${{ github.event.issue.number || 'all' }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
label:
24+
name: Label issues by author trust
25+
runs-on: ubuntu-24.04
26+
steps:
27+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
28+
with:
29+
script: |
30+
const { owner, repo } = context.repo;
31+
// Only listed authors get a label; open issues number in the thousands,
32+
// so unvouched is the default and stays unlabelled.
33+
const labelByStatus = { vouched: "vouch:trusted", denounced: "vouch:denounced" };
34+
const managedLabelNames = new Set(["vouch:trusted", "vouch:unvouched", "vouch:denounced"]);
35+
36+
const { data: file } = await github.rest.repos.getContent({
37+
owner,
38+
repo,
39+
path: ".github/VOUCHED.td",
40+
ref: context.payload.repository.default_branch,
41+
});
42+
const statusByUser = new Map();
43+
for (const raw of Buffer.from(file.content, "base64").toString("utf8").split("\n")) {
44+
const match = /^(-?)github:(\S+)/.exec(raw.trim());
45+
if (match) statusByUser.set(match[2].toLowerCase(), match[1] ? "denounced" : "vouched");
46+
}
47+
48+
const issues =
49+
context.eventName === "issues"
50+
? [context.payload.issue]
51+
: (
52+
await github.paginate(github.rest.issues.listForRepo, {
53+
owner,
54+
repo,
55+
state: "open",
56+
per_page: 100,
57+
})
58+
).filter((issue) => !issue.pull_request);
59+
60+
for (const issue of issues) {
61+
const status = statusByUser.get(issue.user.login.toLowerCase());
62+
const next = labelByStatus[status];
63+
const current = issue.labels.map((label) => label.name).filter((name) => managedLabelNames.has(name));
64+
65+
for (const name of current) {
66+
if (name === next) continue;
67+
try {
68+
await github.rest.issues.removeLabel({ owner, repo, issue_number: issue.number, name });
69+
} catch (error) {
70+
if (error.status !== 404) throw error;
71+
}
72+
}
73+
if (next && !current.includes(next)) {
74+
await github.rest.issues.addLabels({ owner, repo, issue_number: issue.number, labels: [next] });
75+
core.info(`Issue #${issue.number} (${issue.user.login}): ${status} -> ${next}`);
76+
}
77+
}

‎.github/workflows/pr-vouch.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ jobs:
101101
{
102102
name: "vouch:trusted",
103103
color: "1f883d",
104-
description: "PR author is trusted by repo permissions or the VOUCHED list.",
104+
description: "Author is trusted by repo permissions or the VOUCHED list.",
105105
},
106106
{
107107
name: "vouch:unvouched",
108108
color: "fbca04",
109-
description: "PR author is not yet trusted in the VOUCHED list.",
109+
description: "Author is not yet trusted in the VOUCHED list.",
110110
},
111111
{
112112
name: "vouch:denounced",
113113
color: "d1242f",
114-
description: "PR author is explicitly blocked by the VOUCHED list.",
114+
description: "Author is explicitly blocked by the VOUCHED list.",
115115
},
116116
];
117117

0 commit comments

Comments
 (0)