Skip to content

Commit 8facc60

Browse files
committed
fix(ci): block agent PR title prefixes
1 parent d5706cd commit 8facc60

3 files changed

Lines changed: 43 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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 disallowedAgentPrefix =
11+
/^\[(codex|claude|claude-code|openai|chatgpt|copilot|cursor|aider|devin|agent|ai)\](?:\s|:|-|$)/i;
12+
13+
if (disallowedAgentPrefix.test(title)) {
14+
console.error(`Invalid PR title: ${title}`);
15+
console.error('Remove the leading agent/tool prefix. Use a concrete conventional-commits title instead, for example:');
16+
console.error(' fix(ci): block agent PR title prefixes');
17+
process.exit(1);
18+
}

0 commit comments

Comments
 (0)