name: Pull request policy on: pull_request: types: [opened, edited, synchronize, reopened] permissions: contents: read jobs: policy: name: pull-request-policy runs-on: ubuntu-latest steps: - name: Validate branch flow and title env: BASE: ${{ github.base_ref }} HEAD: ${{ github.head_ref }} TITLE: ${{ github.event.pull_request.title }} run: | if [ "$BASE" = "master" ] && [ "$HEAD" != "develop" ]; then echo "::error::master only accepts pull requests from develop" exit 1 fi if [ "$BASE" = "develop" ] && ! printf '%s' "$TITLE" | grep -Eq '^(feat|fix|docs|test|refactor|perf|build|ci|chore|revert)(\([a-z0-9._/-]+\))?!?: .+'; then echo "::error::use a Conventional Commit pull request title" exit 1 fi