Skip to content

Commit c0965b7

Browse files
Merge branch 'main' into alex-fix-bump-warning
2 parents c9c71a8 + a568c65 commit c0965b7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Validate Jira Key in Pull Request
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, edited]
6+
push:
7+
branches: main # check how it can be always the default, either master or main or whatever
8+
9+
jobs:
10+
validate_jira_key:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Validate Jira Key
14+
if: ${{ github.event_name != 'push' }}
15+
run: |
16+
pr_title=$(curl -s \
17+
-H "Accept: application/vnd.github.v3+json" \
18+
${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.number }} | \
19+
jq -r '.title')
20+
21+
if [[ ! $pr_title =~ (\(|\[)?[A-Z]+-[0-9]+(,[A-Z]+-[0-9]+)*(\)|\])? ]]; then
22+
echo "ERROR: Pull request title does not contain a valid Jira key."
23+
echo "Edit the PR title and retrigger the workflow"
24+
exit 1
25+
else
26+
echo "PR title is valid."
27+
fi

0 commit comments

Comments
 (0)