From 3cdddbe31d0488445bb747ca6959ce077776b829 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:04:17 +0100 Subject: [PATCH] ci: Check pull request titles for the commit convention format (#10334) ci: check pull request titles --- .github/workflows/pr-triage.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/pr-triage.yml b/.github/workflows/pr-triage.yml index 0ceab25aaedf..6886980cba6b 100644 --- a/.github/workflows/pr-triage.yml +++ b/.github/workflows/pr-triage.yml @@ -1,6 +1,11 @@ name: 'PR Triage' on: pull_request_target: + types: + - opened + - edited + - reopened + - synchronize jobs: pr-triage: name: PR Triage @@ -8,6 +13,19 @@ jobs: steps: - name: Automatically label PR uses: actions/labeler@v5 + if: github.event.action != 'edited' with: repo-token: '${{ secrets.GITHUB_TOKEN }}' sync-labels: true + + - name: Validate commit convention + if: github.event.action != 'synchronize' + run: | + TITLE="${{ github.event.pull_request.title }}" + REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\\(.+\\))?: .{1,72}$" + + echo "Title: \"$TITLE\"" + + if [[ ! "$TITLE" =~ $REGEX ]]; then + exit 1 + fi