Skip to content

VIDCS-3248: Updating title does not re-run the CI job #1

VIDCS-3248: Updating title does not re-run the CI job

VIDCS-3248: Updating title does not re-run the CI job #1

name: check-pull-request-title
on:
pull_request:
types: [assigned, edited, opened, synchronize, reopened]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
run:
runs-on: [self-hosted]
steps:
- name: Validate PR title
run: |
set -e
pr_name="${{ github.event.pull_request.title }}"
echo "PR Title: '$pr_name'"
# 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 [[ "$pr_name" =~ $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