feat: Add cocogitto conventional commits check#67
Conversation
Check PR commits are compliant, so we can generate changelogs automagically.
There was a problem hiding this comment.
Pull request overview
Adds a Cocogitto-based conventional commit check to pull requests so commit messages can be validated consistently and used for changelog generation.
Changes:
- Add a
cog.tomlCocogitto configuration (tag prefix, merge-commit ignore, custom commit types). - Add a GitHub Actions workflow to run
cog checkagainst PR commits.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cog.toml |
Introduces Cocogitto configuration used by CI to validate/interpret commit messages. |
.github/workflows/cog.yaml |
Adds a PR workflow that checks commit message compliance via cocogitto-action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fetch-depth: 0 | ||
| # pick the pr HEAD instead of the merge commit | ||
| ref: ${{github.event.pull_request.head.sha}} | ||
| - name: Conventional commit check | ||
| uses: cocogitto/cocogitto-action@v4.1.0 | ||
| with: | ||
| command: check | ||
| args: ${{github.event.pull_request.base.sha}}..${{github.event.pull_request.head.sha}} |
There was a problem hiding this comment.
actions/checkout is pinned to the PR head SHA, but the cog check range references ${{ github.event.pull_request.base.sha }} as well. If the PR branch is behind the base branch, that base SHA may not exist in the checked-out repository, causing cog/git to fail resolving the range. Consider explicitly fetching the base ref/SHA (or computing the merge-base between base and head) before running the check so the revision range is always available.
| uses: actions/checkout@v6.0.2 | ||
| with: | ||
| fetch-tags: true | ||
| fetch-depth: 0 | ||
| # pick the pr HEAD instead of the merge commit | ||
| ref: ${{github.event.pull_request.head.sha}} | ||
| - name: Conventional commit check | ||
| uses: cocogitto/cocogitto-action@v4.1.0 | ||
| with: | ||
| command: check | ||
| args: ${{github.event.pull_request.base.sha}}..${{github.event.pull_request.head.sha}} |
There was a problem hiding this comment.
This workflow uses ${{github.*}} expressions without the spacing used elsewhere in this repo (e.g., ${{ github.* }} in .github/workflows/ci.yaml) and pins actions/checkout to v6.0.2 while other workflows use actions/checkout@v6. Aligning these improves consistency and avoids relying on a potentially non-existent patch tag.
| uses: actions/checkout@v6.0.2 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| # pick the pr HEAD instead of the merge commit | |
| ref: ${{github.event.pull_request.head.sha}} | |
| - name: Conventional commit check | |
| uses: cocogitto/cocogitto-action@v4.1.0 | |
| with: | |
| command: check | |
| args: ${{github.event.pull_request.base.sha}}..${{github.event.pull_request.head.sha}} | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| # pick the pr HEAD instead of the merge commit | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Conventional commit check | |
| uses: cocogitto/cocogitto-action@v4.1.0 | |
| with: | |
| command: check | |
| args: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} |
Check PR commits are compliant, so we can generate changelogs automagically.