diff --git a/.github/actions/validate-pr-title/action.yml b/.github/actions/validate-pr-title/action.yml index abf533c937..eff7261057 100644 --- a/.github/actions/validate-pr-title/action.yml +++ b/.github/actions/validate-pr-title/action.yml @@ -37,7 +37,17 @@ runs: using: composite steps: - name: "Check PR title follows '${{ inputs.validate-semVer == true && '+semver: ' || '' }} '" - 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