From 4869d609b514f31f191d47f28fd0b6672117b210 Mon Sep 17 00:00:00 2001 From: Chris Warren <16132615+c-warren@users.noreply.github.com> Date: Fri, 3 Oct 2025 16:38:46 -0700 Subject: [PATCH] ci: Lint PR titles with Conventional Commits standard Signed-off-by: Chris Warren <16132615+c-warren@users.noreply.github.com> --- .github/workflows/semantic-pr.yml | 72 +++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/semantic-pr.yml diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml new file mode 100644 index 000000000..39e467058 --- /dev/null +++ b/.github/workflows/semantic-pr.yml @@ -0,0 +1,72 @@ +name: Semantic Pull Request + +on: + pull_request: + types: + - opened + - edited + - synchronize + +jobs: + semantic-pr: + name: Validate PR title follows conventional commit format + runs-on: ubuntu-latest + # TODO: Remove this once we commit to conventional commits + continue-on-error: true + + steps: + - name: Validate PR title + id: lint_pr_title + uses: amannn/action-semantic-pull-request@v5.4.0 + with: + # Allow standard conventional commit types + types: | + fix + feat + docs + style + refactor + perf + test + chore + ci + build + # TODO: Remove this once we've decided on scopes + requireScope: false + # Skip validation for certain labels if needed + ignoreLabels: | + skip-commit-format + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Comment on PR if validation fails + if: steps.lint_pr_title.outputs.error_message != null + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `⚠️ **Semantic PR Check Failed** + + **Error Details:** + \`\`\` + ${{ steps.lint_pr_title.outputs.error_message }} + \`\`\` + + **Required Format:** + \`\`\` + : + \`\`\` + + **Allowed types:** fix, feat, docs, style, refactor, perf, test, chore, ci, build + + **Examples:** + - \`feat: add user authentication system\` + - \`fix: resolve memory leak in worker pool\` + - \`docs: update API documentation\` + - \`test: add integration tests for auth flow\` + + This is currently a **warning only** and won't block your PR from being merged.` + })