DTSW-7168-Correct-any-spelling-or-grammatical-errors-in-the-Duckietown-Manual #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Enforce Jira Key in PR Title and Branch | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened] | |
| jobs: | |
| check-jira-key: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR title and branch name for Jira issue key | |
| run: | | |
| echo "🔍 Checking PR title and branch name..." | |
| JIRA_PATTERN="DTSW-[0-9]{4,}" | |
| TITLE="${{ github.event.pull_request.title }}" | |
| BRANCH="${{ github.event.pull_request.head.ref }}" | |
| echo "📌 PR Title: $TITLE" | |
| echo "📌 Branch: $BRANCH" | |
| TITLE_OK=$(echo "$TITLE" | grep -E "$JIRA_PATTERN" || true) | |
| BRANCH_OK=$(echo "$BRANCH" | grep -E "$JIRA_PATTERN" || true) | |
| if [ -z "$TITLE_OK" ] && [ -z "$BRANCH_OK" ]; then | |
| echo "❌ Neither PR title nor branch name contains a valid Jira issue key (DTSW-XXXX)" | |
| echo "🚫 Merge blocked: Jira issue key must be present in either PR title or branch name" | |
| exit 1 | |
| fi | |
| if [ -n "$TITLE_OK" ] && [ -n "$BRANCH_OK" ]; then | |
| echo "✅ Jira issue key found in both PR title and branch name." | |
| elif [ -n "$TITLE_OK" ]; then | |
| echo "✅ Jira issue key found in PR title." | |
| elif [ -n "$BRANCH_OK" ]; then | |
| echo "✅ Jira issue key found in branch name." | |
| fi |