Skip to content

Commit 2f02ad3

Browse files
emlautarom1Copilot
andauthored
ci: validate PR naming convention (#217)
* Initial workflow - Validate style conformance * Fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Avoid potential injection due to PR title --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d112833 commit 2f02ad3

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PR Naming Convention
2+
on:
3+
pull_request:
4+
types: [edited, opened, synchronize, reopened]
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
title-check:
12+
runs-on: ubuntu-24.04
13+
timeout-minutes: 5
14+
steps:
15+
- name: Validate PR
16+
env:
17+
PR_TITLE: "${{ github.event.pull_request.title }}"
18+
run: |
19+
if [[ ! "$PR_TITLE" =~ ^(fix|feat|build|chore|docs|test|refactor|ci|localize|bump|revert)(\([a-z0-9\-]+\))?:\ .+$ ]]; then
20+
echo "Error: PR title does not follow the convention: '$PR_TITLE'"
21+
echo "Expected format: <type>[(scope)]: <description>"
22+
echo "Where:"
23+
echo " <type> is one of fix, feat, build, chore, docs, test, refactor, ci, localize, bump or revert"
24+
echo " <scope> is an optional lowercase string with hyphens or numbers"
25+
echo " <description> is a brief summary of the change"
26+
exit 1
27+
fi
28+
shell: bash

0 commit comments

Comments
 (0)