Skip to content

Commit

Permalink
chore(feat): in-house PR title check script.
Browse files Browse the repository at this point in the history
  • Loading branch information
rash805115 committed Apr 4, 2024
1 parent 46a71a9 commit 2851372
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
5 changes: 2 additions & 3 deletions .husky/commit-msg → .github/jobs/validate-pr-title.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"

: '
Release Definitions
Expand All @@ -21,8 +20,8 @@ Release Category Matrix
'
PATTERN_COMMITS='^(chore|major|minor|patch)\((docs|feat|fix|refactor|release|revert|test)\):\ .+\.$'

msg="$(cat $1 | head -n 1)"
msg=${{ github.event.pull_request.title }}
if ! [[ "$msg" =~ $PATTERN_COMMITS ]]; then
echo -e "\x1b[31mError commit message: \x1b[0m \x1b[33m"$msg"\x1b[0m does not follow our standards. See regex in \".husky/commit-msg\".' \x1b[33m"
echo -e "\x1b[31mPR title: \x1b[0m \x1b[33m"$msg"\x1b[0m s not valid! Please see regex in \".github/jobs/validate-pr-title.sh\".' \x1b[33m"
exit 1;
fi
8 changes: 0 additions & 8 deletions .github/validate-pr-title.config.json

This file was deleted.

18 changes: 13 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Pull Request Workflow"

on:
pull_request:
types:
Expand All @@ -7,16 +8,23 @@ on:
- opened
- ready_for_review
- synchronize

jobs:
checkout:
name: Checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

validate-pr-title:
continue-on-error: true
name: Validate PR Title
needs: [checkout]
permissions:
pull-requests: write
contents: write
contents: read
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: thehanimo/pr-title-checker@v1.4.1
- run: sh .github/jobs/validate-pr-title.sh
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: .github/validate-pr-title.config.json
1 change: 0 additions & 1 deletion dictionary.dic
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ subnets
Svg
tagline
tcp
thehanimo
tsbuildinfo
tsc
tsconfig
Expand Down

0 comments on commit 2851372

Please sign in to comment.