Files
get-shit-done/.github/workflows/branch-naming.yml
Tom Boucher 553d9db56e ci: upgrade GitHub Actions to Node 22+ runtimes (#2128)
- actions/checkout v4.2.2 → v6.0.2 (pr-gate, auto-branch)
- actions/github-script v7.0.1/v8 → v9.0.0 (all workflows)
- actions/stale v9.0.0 → v10.2.0

Eliminates Node.js 20 deprecation warnings. Node 20 actions
will be forced to Node 24 on June 2, 2026 and removed Sept 16, 2026.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 16:28:18 -04:00

39 lines
1.3 KiB
YAML

name: Validate Branch Name
on:
pull_request:
types: [opened, synchronize]
permissions: {}
jobs:
check-branch:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Validate branch naming convention
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const branch = context.payload.pull_request.head.ref;
const validPrefixes = [
'feat/', 'fix/', 'hotfix/', 'docs/', 'chore/',
'refactor/', 'test/', 'release/', 'ci/', 'perf/', 'revert/',
];
const alwaysValid = ['main', 'develop'];
if (alwaysValid.includes(branch)) return;
if (branch.startsWith('dependabot/') || branch.startsWith('renovate/')) return;
// GSD auto-created branches
if (branch.startsWith('gsd/') || branch.startsWith('claude/')) return;
const isValid = validPrefixes.some(prefix => branch.startsWith(prefix));
if (!isValid) {
const prefixList = validPrefixes.map(p => `\`${p}\``).join(', ');
core.warning(
`Branch "${branch}" doesn't follow naming convention. ` +
`Expected prefixes: ${prefixList}`
);
}