Skip to content
Draft
16 changes: 13 additions & 3 deletions .github/actions/validate-pr-title/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ runs:
using: composite
steps:
- name: "Check PR title follows '${{ inputs.validate-semVer == true && '+semver: <minor|major|patch> ' || '' }}<ticket id> <description>'"
uses: deepakputhraya/action-pr-title@3864bebc79c5f829d25dd42d3c6579d040b0ef16 #v1.0.2
with:
regex: ^${{ inputs.validate-semVer == true && '(\+semver:\s(minor|major|patch)\s)?' || '' }}([A-Z][A-Z0-9]*-\d+(:)?\s\w)
if: ${{ contains(github.head_ref, 'release/') == false && contains(github.head_ref, 'merge/') == false }}
shell: bash
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
SEMVER_PREFIX: ${{ inputs.validate-semVer == true && '(\+semver:\s(minor|major|patch)\s)?' || '' }}
run: |
TITLE=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json title --jq '.title')
REGEX="^${SEMVER_PREFIX}([A-Z][A-Z0-9]*-[0-9]+(:)?\s\w)"
if ! echo "$TITLE" | grep -Pq "$REGEX"; then
echo "::error::Pull Request title \"$TITLE\" failed to pass match regex - $REGEX"
exit 1
fi
Loading