Skip to content

ci: enforce conventional commits on PRs via GitHub Actions#67

Merged
jfernandez merged 1 commit intojfernandez:mainfrom
alma-seele:ci/add-commitlint
Feb 15, 2026
Merged

ci: enforce conventional commits on PRs via GitHub Actions#67
jfernandez merged 1 commit intojfernandez:mainfrom
alma-seele:ci/add-commitlint

Conversation

@alma-seele
Copy link
Copy Markdown
Collaborator

@alma-seele alma-seele commented Feb 15, 2026

Summary

Adds automated commit message validation to enforce conventional commit format on all pull requests via GitHub Actions.

How It Works

The workflow:

  1. Triggers on PR open, sync, or reopen events
  2. Fetches the full commit history and base branch
  3. Compares all commits between the base branch and PR head using git log origin/main..HEAD
  4. Validates each commit message against the conventional commit pattern:
    type(optional-scope): description
    
  5. Reports which commits pass/fail with clear feedback and examples

Valid types: feat, fix, docs, chore, refactor, test, ci, perf, style, revert

Changes

  • .github/workflows/commitlint.yml - GitHub Actions workflow that validates commit messages
    • Fetches base branch explicitly to ensure proper comparison
    • Pure bash implementation (no external dependencies)
    • Provides helpful error messages with format examples
  • CONTRIBUTING.md - Comprehensive contributing guide with:
    • Conventional commit format specification
    • Valid commit types and scopes
    • Real-world examples
    • Pull request process
  • README.md - Updated to reference CONTRIBUTING.md

Example Output

Valid commits pass:

✅ feat: add support for subdirectory images
✅ fix: resolve websocket connection timeout
✅ ci: add conventional commit validation

Invalid commits fail with helpful feedback:

❌ Added new feature
   ^ Does not match conventional commit format

Expected format: type(optional-scope): description
Valid types: feat, fix, docs, chore, refactor, test, ci, perf, style, revert

Examples:
  feat: add support for subdirectory images
  fix: resolve websocket connection timeout

Benefits

  • Enforces existing conventional commit standard automatically
  • Immediate feedback to contributors during PR review
  • Maintains clean, semantic commit history for changelogs
  • Zero external dependencies (pure bash)
  • Can be required via branch protection rules

@alma-seele alma-seele changed the title ci: add conventional commit validation ci: enforce conventional commits on PRs via GitHub Actions Feb 15, 2026
Validates all commits in pull requests against conventional commit
format via GitHub Actions workflow. The check fails if any commit
does not match the expected pattern (type: description).

Workflow fetches base branch and compares commits using git log to
ensure proper validation for PRs from forks. Provides clear feedback
showing which commits are invalid with format examples.

Also adds CONTRIBUTING.md with detailed commit guidelines.
@jfernandez jfernandez merged commit 01a0ae4 into jfernandez:main Feb 15, 2026
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