-
Notifications
You must be signed in to change notification settings - Fork 9
33 lines (32 loc) · 1.26 KB
/
check_tittle.yml
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
name: Check PR Title
on:
pull_request:
types: [opened, edited, reopened]
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN_SECRET }}
GIT_TOKEN_SECRET: ${{ secrets.GIT_TOKEN_SECRET }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
jobs:
check_pr_title:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
run: git clone -q https://${GIT_TOKEN_SECRET}@github.com/${OWNER}/${REPO}.git --depth=2
- name: Check Jira ID on PR title
run: |
cd ${REPO} || exit
pr_id=$(jq --raw-output .pull_request.number "${GITHUB_EVENT_PATH}")
pr_author=$(jq --raw-output .pull_request.user.login "${GITHUB_EVENT_PATH}")
pr_title=$(jq --raw-output .pull_request.title "${GITHUB_EVENT_PATH}")
if [[ ${pr_title} =~ ^\[DEVAUTOM-[0-9]+\] ]]; then
echo -e "(√) Title '${pr_title}' is ok!"
exit 0
else
echo -e "(x) Title '${pr_title}' is not ok!"
gh issue comment ${pr_id} --body ":x: @${pr_author} this pull request title '${pr_title}' is incorrect!
Please insert your Jira ID issue on title according the follow convention:
'[DEVAUTOM-12345] <PR title>'"
exit 1
fi
shell: bash