Skip to content

Commit fd8ae87

Browse files
committed
Enforce PR title to include Jira ticket
1 parent d90b680 commit fd8ae87

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919

2020
permissions: write-all
2121
jobs:
22+
2223
# Create TestRail run
2324
create-testrail-run:
2425
name: Create TestRail Run
@@ -27,11 +28,17 @@ jobs:
2728
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
2829
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
2930

31+
# PR title check
32+
pr-title-check:
33+
name: Check PR title
34+
uses: ./.github/workflows/pr-title-check.yaml
35+
needs: create-testrail-run
36+
3037
# Build and run unit tests
3138
build-and-test:
3239
name: Build and test
3340
uses: ./.github/workflows/build-and-test.yaml
34-
needs: create-testrail-run
41+
needs: pr-title-check
3542
secrets:
3643
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
3744
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -45,7 +52,7 @@ jobs:
4552
name: Integration tests
4653
uses: ./.github/workflows/integration-tests.yaml
4754
if: ${{ vars.ENABLE_INTEGRATION_TESTS == 'true' }}
48-
needs: create-testrail-run
55+
needs: pr-title-check
4956
secrets:
5057
E2E_CONFIG: ${{ secrets.E2E_CONFIG }}
5158
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR Title Check
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
pr-title-check:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Validate PR title starts with Jira key
11+
shell: bash
12+
run: |
13+
set -euo pipefail
14+
TITLE="${{ github.event.pull_request.title }}"
15+
echo "PR title: $TITLE"
16+
17+
# Require: SDKS-<digits> <space> <anything>
18+
PATTERN='^SDKS-[0-9]+[[:space:]].+'
19+
20+
if [[ ! "$TITLE" =~ $PATTERN ]]; then
21+
echo "::error::PR title must start with 'SDKS-<number> ' (example: 'SDKS-4770 Aligning storage strategy with Android')."
22+
exit 1
23+
fi
24+
25+
echo "Title OK"

0 commit comments

Comments
 (0)