Skip to content

VIDCS-3369: Adding SonarScan on PRs #95

VIDCS-3369: Adding SonarScan on PRs

VIDCS-3369: Adding SonarScan on PRs #95

name: check-pull-request-title
on:
pull_request:
types: [edited, opened]
permissions:
contents: read
jobs:
run:
runs-on: ubuntu-22.04
steps:
- name: Validate PR title
env:
PR_NAME: ${{ github.event.pull_request.title }}
run: |
set -e
# Regex to check following:
# Starts with "VIDCS-" followed by digits
# A colon (:) followed by exactly one space
# followed by the actual PR title text
regex="^VIDCS-[0-9]+: [^ ].*$"
if echo "$PR_NAME" | grep -Eq "$regex"; then
echo "Acceptable title"
exit 0
else
echo "Rejected title"
echo "Reason: The PR title must start with 'VIDCS-' followed by digits, a colon (:), and exactly one space, with the rest of the title immediately after the space."
exit 1
fi
shell: bash