Skip to content

Commit a9ac275

Browse files
authored
.github/workflows: naive PR format checker (#32480)
Full disclosure: this has been generated by AI. The goal is to have a quick check that the PR format is correct, before we merge it. This is to avoid the periodical case when someone forgets to add a milestone or check the title matches our preferred format.
1 parent d0602ba commit a9ac275

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/validate_pr.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PR Format Validation
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
validate-pr:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check PR Title Format
12+
uses: actions/github-script@v7
13+
with:
14+
script: |
15+
const prTitle = context.payload.pull_request.title;
16+
const titleRegex = /^(\.?[\w\s,{}/]+): .+/;
17+
18+
if (!titleRegex.test(prTitle)) {
19+
core.setFailed(`PR title "${prTitle}" does not match required format: directory, ...: description`);
20+
return;
21+
}
22+
23+
console.log('✅ PR title format is valid');

0 commit comments

Comments
 (0)