From dda7be54b90009b79e4d4a95cc653fbdc11c1e03 Mon Sep 17 00:00:00 2001 From: mldangelo-oai Date: Fri, 7 Aug 2026 23:01:56 -0700 Subject: [PATCH 1/2] ci: enforce conventional pull request titles --- .github/workflows/validate-pr-title.yml | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/validate-pr-title.yml diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml new file mode 100644 index 00000000..d868507e --- /dev/null +++ b/.github/workflows/validate-pr-title.yml @@ -0,0 +1,33 @@ +name: Validate PR Title + +on: + pull_request_target: + branches: [main] + types: [opened, edited, reopened, synchronize] + +permissions: + pull-requests: read + +jobs: + validate-pr-title: + name: Validate PR Title + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 + with: + types: | + build + chore + ci + docs + feat + fix + perf + refactor + release + revert + style + test + env: + GITHUB_TOKEN: ${{ github.token }} From 081e5be0b74c50b0b87aac49aa9f4ee59c593d87 Mon Sep 17 00:00:00 2001 From: Michael D'Angelo Date: Mon, 10 Aug 2026 14:21:19 -0700 Subject: [PATCH 2/2] ci: validate pull request titles without third-party action --- .github/workflows/validate-pr-title.yml | 30 +++++++++---------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml index d868507e..3d35cbf8 100644 --- a/.github/workflows/validate-pr-title.yml +++ b/.github/workflows/validate-pr-title.yml @@ -1,33 +1,23 @@ name: Validate PR Title on: - pull_request_target: + pull_request: branches: [main] types: [opened, edited, reopened, synchronize] -permissions: - pull-requests: read +permissions: {} jobs: validate-pr-title: name: Validate PR Title runs-on: ubuntu-latest - timeout-minutes: 5 steps: - - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 - with: - types: | - build - chore - ci - docs - feat - fix - perf - refactor - release - revert - style - test + - name: Check conventional title env: - GITHUB_TOKEN: ${{ github.token }} + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|release|revert|style|test)(\([^()[:space:]]+\))?!?:[[:space:]][^[:space:]].*$' + if [[ ! "$PR_TITLE" =~ $pattern ]]; then + echo '::error::PR titles must use a supported Conventional Commit type.' + exit 1 + fi