Skip to content

Commit 4e781d1

Browse files
authored
Merge pull request #183 from NHSDigital/feature/CCM-15317_enforce_jira_in_pr_title
CCM-15317: Adding New PR Enforcement Action
2 parents bc7d12f + 1132f7d commit 4e781d1

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Validate PR title
2+
description: "Validate pull request title against a regex"
3+
inputs:
4+
title:
5+
description: "Pull request title"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: "Validate PR title"
11+
shell: bash
12+
env:
13+
TITLE: ${{ inputs.title }}
14+
run: |
15+
title="$TITLE"
16+
pattern='^CCM-[0-9]+: .+$'
17+
message='PR title must match: CCM-1234: Some Text'
18+
19+
echo "PR title: $title"
20+
21+
if printf '%s\n' "$title" | grep -Eq -- "$pattern"; then
22+
echo "PR title is valid"
23+
else
24+
echo "::error::$message"
25+
exit 1
26+
fi

0 commit comments

Comments
 (0)