Skip to content

Commit 010f8c5

Browse files
committed
fix(ci): block agent PR title prefixes
1 parent d449c6c commit 010f8c5

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
pr-title:
13+
name: Check PR title
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
18+
- name: Check for agent/tool PR title prefix
19+
env:
20+
PR_TITLE: ${{ github.event.pull_request.title }}
21+
run: node scripts/check-pr-title.cjs "$PR_TITLE"

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ADCP Python SDK - Agent Reference
22

3+
## PR Title Hygiene
4+
5+
Use concrete conventional-commits PR titles (`fix(scope): summary`, `docs: summary`, `feat(scope): summary`). Do not prefix titles with the tool or model that authored the PR, such as `[codex]`, `[claude]`, `[cursor]`, or similar ownership tags. Put authoring-tool context in the PR body or labels when it matters, not in the review-facing title.
6+
37
## Server Handler Methods
48

59
Override these in your `ADCPHandler` subclass. Unimplemented methods return `not_supported()`.

scripts/check-pr-title.cjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env node
2+
3+
const title = (process.argv.slice(2).join(' ') || process.env.PR_TITLE || '').trim();
4+
5+
if (!title) {
6+
console.error('PR title is empty.');
7+
process.exit(1);
8+
}
9+
10+
const prefixMatch = title.match(/^\[([^\]]+)\](?:\s|:|-|$)/);
11+
const agentTokens = new Set([
12+
'agent',
13+
'agents',
14+
'ai',
15+
'aider',
16+
'chatgpt',
17+
'claude',
18+
'codex',
19+
'copilot',
20+
'cursor',
21+
'devin',
22+
'openai',
23+
]);
24+
25+
const hasAgentPrefix =
26+
prefixMatch &&
27+
prefixMatch[1]
28+
.toLowerCase()
29+
.split(/[^a-z0-9]+/)
30+
.some((token) => agentTokens.has(token));
31+
32+
if (hasAgentPrefix) {
33+
console.error(`Invalid PR title: ${title}`);
34+
console.error('Remove the leading agent/tool prefix. Use a concrete conventional-commits title instead, for example:');
35+
console.error(' fix(ci): block agent PR title prefixes');
36+
process.exit(1);
37+
}

0 commit comments

Comments
 (0)