Skip to content

ci(workflows): add semantic PR title lint workflow#79

Merged
snowrugar-beep merged 2 commits into
VertexChainLabs:mainfrom
Moonwalker-rgb:ci/pr-title-lint-workflow
Jun 22, 2026
Merged

ci(workflows): add semantic PR title lint workflow#79
snowrugar-beep merged 2 commits into
VertexChainLabs:mainfrom
Moonwalker-rgb:ci/pr-title-lint-workflow

Conversation

@Moonwalker-rgb

Copy link
Copy Markdown
Contributor

Summary

Adds .github/workflows/pr-title-lint.yml, a GitHub Actions workflow that enforces Conventional Commits-style PR titles on every pull request against main. This unlocks automated changelog categorization and complements (does not replace) the existing CI matrix in .github/workflows/ci.yml.

Closes #36.

What this workflow does

  • Trigger: pull_request events [opened, edited, reopened, synchronize] against the main branch.
  • Action: amannn/action-semantic-pull-request@v5.5.0 (pinned to a specific patch, matching the @vX.Y.Z convention used in ci.yml).
  • Allowed types (explicit allowlist): feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert — mirrors the spec in CONTRIBUTING.md.
  • Subject pattern: ^(\w+)(?:\([\w\-\.\/]+\))?!?: .+$ — accepts <type>[(scope)][!]: <summary> with optional scope (intentional, matches the existing mix of scoped/unscoped commit log) and optional ! for breaking changes per the Conventional Commits spec.
  • Friendly error message: points contributors at CONTRIBUTING.md with worked examples.
  • Security: uses pull_request, not pull_request_target, so secrets stay safe on fork PRs.
  • Permissions (least-privilege): contents: read, pull-requests: read, statuses: write.
  • Concurrency: group keyed by PR number with cancel-in-progress: true so superseded runs cancel when authors iterate on the title.
  • No checkout step: the action reads PR metadata via the GitHub API, not the working tree.

Docs change

CONTRIBUTING.md — under "Pull Request Guidelines", the Title bullet now references the new workflow so contributors see the automated enforcement alongside the existing example list.

Validation performed

  • YAML parses; the rendered types JSON loads back into the expected 11-entry array (validated with python3 + PyYAML).
  • A code-review pass was performed on the workflow and the CONTRIBUTING.md edit; all actionable feedback was applied (literal-block JSON encoding, scope-is-optional rationale, etc.).
  • The commit subject and PR title follow Conventional Commits and would themselves pass the new lint.

Checklist

  • Workflow follows the style of .github/workflows/ci.yml (permissions, concurrency, comments).
  • Action pinned to a specific patch.
  • No actions/checkout step.
  • Documentation updated.
  • Commits and PR title follow Conventional Commits.

Adds .github/workflows/pr-title-lint.yml using

amannn/action-semantic-pull-request@v5.5.0 to enforce

Conventional Commits-style PR titles on every PR open,

edit, reopen, and synchronize against main. The workflow:

- explicitly pins the allowed commit types (matches CONTRIBUTING.md)

- uses pull_request (not pull_request_target) for fork-PR safety

- grants only the minimum permissions the action needs

- cancels superseded runs on PR title iteration

Also tightens CONTRIBUTING.md PR guidelines to reference the

new lint workflow so contributors see the automated enforcement.

Closes VertexChainLabs#36
…in pr-title-lint

Two latent bugs surfaced when the workflow ran against PR VertexChainLabs#79:

1. `types` was encoded as a multi-line JSON array in YAML. The
   amannn action ships a ConfigParser that splits the types input by
   `\n` and trims/filters empties — it does NOT parse a JSON array.
   The earlier YAML therefore silently produced a 13-element garbage
   list (`"[`, `  "feat",`, `"ci",`, `]`, …) so `types.includes(result.type)`
   rejected every title under the message "Unknown release type".
   Switching to newline-delimited plaintext (one type per line).

2. `subjectPattern` was previously `^(\w+)(?:\([\w\-\.\/]+\))?!?: .+$`,
   intended for the FULL title. The action matches it against the
   parsed bare `subject` (after conventional-commits-parser strips
   the `<type>(<scope>)!:` prefix), so the regex would never have
   matched a real subject. Replaced with `^.{1,72}$` enforcing
   CONTRIBUTING.md's `<= 72 chars` rule, with an updated error
   message that points contributors at CONTRIBUTING.md.

Also updated inline comments so a future maintainer cannot
reintroduce the same two bugs.

Closes VertexChainLabs#36

@snowrugar-beep snowrugar-beep left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@snowrugar-beep snowrugar-beep merged commit c30e5d3 into VertexChainLabs:main Jun 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: add semantic PR title linting workflow

2 participants