From ca972bc3f0667ff9b82ad288d455e87c4b1f2836 Mon Sep 17 00:00:00 2001 From: Chris Warren <16132615+c-warren@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:08:35 -0700 Subject: [PATCH] ci: Add conventional commit linter Signed-off-by: Chris Warren <16132615+c-warren@users.noreply.github.com> --- .github/dco.yml | 2 + .github/workflows/semantic-pr.yml | 72 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/dco.yml create mode 100644 .github/workflows/semantic-pr.yml diff --git a/.github/dco.yml b/.github/dco.yml new file mode 100644 index 0000000..0c4b142 --- /dev/null +++ b/.github/dco.yml @@ -0,0 +1,2 @@ +require: + members: false diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml new file mode 100644 index 0000000..797bab2 --- /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.` + }) \ No newline at end of file