-
Notifications
You must be signed in to change notification settings - Fork 6
Enforce conventional commits #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
36a74ce
chore(commit): Enforce conventional commits
piotrzajac 3df6aea
chore(ci): Improve commit message workflow
piotrzajac 9737597
chore(ci): Fix lint summary
piotrzajac ac3f7cb
chore(ci): Improve summary readability
piotrzajac 331b3a6
chore(conf): validate message scope
piotrzajac 834aff3
chore(ci): no need for .net setup
piotrzajac d7a8b44
chore(ci): Indicate when lint step fails early
piotrzajac b4493a5
chore(ci): Simplify writing to GITHUB_OUTPUT
piotrzajac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: '📝 Commit Message Lint' | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| push: | ||
| branches: | ||
| - 'master' | ||
| workflow_dispatch: | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: pwsh | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: windows-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: 📥 checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: 🛠️ setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: 8.0.x | ||
|
|
||
| - name: 📦 restore local tools | ||
| run: dotnet tool restore | ||
|
|
||
| - name: ✅ lint commit messages | ||
| run: | | ||
| $messagePath = Join-Path $env:RUNNER_TEMP "commit-message.txt" | ||
| if ("${{ github.event_name }}" -eq "pull_request") { | ||
| $commits = git log --no-merges --pretty="%H" "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" | ||
| } else { | ||
| $commits = git log -1 --pretty="%H" | ||
| } | ||
| foreach ($sha in ($commits -split "`n" | Where-Object { $_ -ne "" })) { | ||
| git log -1 --pretty="%B" $sha | Out-File -FilePath $messagePath -Encoding utf8 | ||
| dotnet commit-lint --commit-file $messagePath --commit-message-config-file commit-message-config.json | ||
| } | ||
|
piotrzajac marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/sh | ||
| . "$(dirname "$0")/_/husky.sh" | ||
|
|
||
| dotnet husky run --group commit-msg --args "$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", | ||
| "tasks": [ | ||
| { | ||
| "name": "commit-message-linter", | ||
| "group": "commit-msg", | ||
| "command": "dotnet", | ||
| "args": [ | ||
| "commit-lint", | ||
| "--commit-file", | ||
| "${args}", | ||
| "--commit-message-config-file", | ||
| "commit-message-config.json" | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "config": { | ||
| "max-subject-length": { | ||
| "enabled": true, | ||
| "value": 90 | ||
| }, | ||
| "conventional-commit": { | ||
| "enabled": true, | ||
| "types": [ | ||
| "feat", | ||
| "fix", | ||
| "refactor", | ||
| "build", | ||
| "chore", | ||
| "style", | ||
| "test", | ||
| "docs", | ||
| "perf", | ||
| "revert", | ||
| "ci" | ||
| ], | ||
| "scopes": { | ||
| "enabled": false, | ||
| "global": [], | ||
| "per-type": {} | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "version": 1, | ||
| "isRoot": true, | ||
| "tools": { | ||
| "husky": { | ||
| "version": "0.9.1", | ||
| "commands": [ | ||
| "husky" | ||
| ], | ||
| "rollForward": true | ||
| }, | ||
| "commitlint.net": { | ||
| "version": "0.8.0", | ||
| "commands": [ | ||
| "commit-lint" | ||
| ], | ||
| "rollForward": true | ||
| }, | ||
| "dotnet-stryker": { | ||
| "version": "4.14.0", | ||
| "commands": [ | ||
| "dotnet-stryker" | ||
| ], | ||
| "rollForward": true | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.