-
Notifications
You must be signed in to change notification settings - Fork 36
35 lines (30 loc) · 1.06 KB
/
pr-title-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: PR Title Check
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
title-check:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Check if PR is internal
id: check_internal
run: |
if [[ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
echo "internal=true" >> $GITHUB_ENV
else
echo "internal=false" >> $GITHUB_ENV
fi
- name: Run title check script
if: env.internal == 'true'
run: |
pr_title="${{ github.event.pull_request.title }}"
pattern="^(Feature|Fix|Bug|Bugfix|Docs|Refactor|Chore|Github)\/SK-[0-9]+ \| .+"
if [[ ! "$pr_title" =~ $pattern ]]; then
echo "Error: PR title does not follow the required pattern."
echo "Please ensure the title follows the pattern: 'Feature|Fix|Bug|Bugfix|Docs|Refactor|Chore|Github/SK-<numbers> | <Summary>'"
exit 1
else
echo "PR title is valid."
fi