Skip to content

feat: accept scoped conventional-commit prefixes in PR title check#97

Merged
nickolas-dimitrakas merged 1 commit into
mainfrom
feat/pr-title-accept-scoped-prefix
Jul 20, 2026
Merged

feat: accept scoped conventional-commit prefixes in PR title check#97
nickolas-dimitrakas merged 1 commit into
mainfrom
feat/pr-title-accept-scoped-prefix

Conversation

@nickolas-dimitrakas

Copy link
Copy Markdown
Contributor

What

Adjusts the semantic PR title check (pr-title-check.yml) to accept both forms of conventional-commit prefix:

  • type: — the bare form it already accepts (e.g. chore: bump dependency)
  • type(scope): — the scoped form (e.g. chore(rokt): bump dependency)

Scoped titles like chore(rokt): bump Rokt SDK dependency to 5.3.0 (SPM + CocoaPods) are still valid conventional-commit titles, but the current check only matches type: via startsWith(...) and fails them.

How

  • Validation moves from a GitHub Actions expression (which supports only startsWith and cannot match an arbitrary scope) to a shell grep -E regex:
    ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([^)]+\))?:
  • The same set of accepted types is preserved.
  • The PR title is passed via an environment variable rather than interpolated directly into run:, removing a script-injection risk that existed in the previous version.

Test cases

Title Result
chore(rokt): bump Rokt SDK dependency to 5.3.0 (SPM + CocoaPods) ✅ pass
feat: add new event ✅ pass
fix(identity): handle nil MPID ✅ pass
Update README ❌ fail
feature: not a real type ❌ fail
chore bump without colon ❌ fail

Note on rollout

Consumer repos pin this workflow at @stable. This PR targets main; the stable tag needs to be advanced for consumers (e.g. mparticle-apple-sdk) to pick up the change.

🤖 Generated with Claude Code

Accept both the bare `type:` form and the scoped `type(scope):` form
(e.g. `chore(rokt): ...`) so that scoped semantic titles no longer fail
the check.

Validation moves from a GitHub expression (startsWith only) to a shell
regex, since expressions cannot match an arbitrary scope. The PR title is
now passed via the environment instead of being interpolated into `run:`,
removing a script-injection risk.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
CI-only workflow change with no runtime app impact; slightly broader title acceptance is intentional.

Overview
The semantic PR title workflow is collapsed into one validation step instead of multiple startsWith checks and separate pass/fail jobs.

Titles must match type: or type(scope): for the same allowed types (feat, fix, chore, etc.), enforced with a grep -E regex in the shell because Actions expressions cannot express optional scopes.

The PR title is read from PR_TITLE env rather than interpolated into run: or echoed from workflow outputs, which closes a shell-injection path from malicious titles. Invalid titles still fail the job with the same type list in the error output.

Reviewed by Cursor Bugbot for commit 7ef73a9. Bugbot is set up for automated code reviews on this repo. Configure here.

@nickolas-dimitrakas nickolas-dimitrakas self-assigned this Jul 20, 2026
@nickolas-dimitrakas
nickolas-dimitrakas merged commit f7e63ab into main Jul 20, 2026
4 checks passed
@nickolas-dimitrakas
nickolas-dimitrakas deleted the feat/pr-title-accept-scoped-prefix branch July 20, 2026 15:14
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.

2 participants