Skip to content

Commit

Permalink
move check pull request title to its own job and update lint.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
behei-vonage committed Jan 14, 2025
1 parent 497d435 commit 6720f5d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/check-pull-request-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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
23 changes: 0 additions & 23 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,6 @@ jobs:
run: |
yarn lint:filenames
- 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

- name: Run license check
run: |
npx license-checker --json > scripts/allLicenseResults.json
Expand Down

0 comments on commit 6720f5d

Please sign in to comment.