-
Notifications
You must be signed in to change notification settings - Fork 1
Add commit message check #1
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 all commits
Commits
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| pull_request: | ||
| merge_group: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Test commit message checker | ||
| run: python3 check-commit-messages/test_check.py | ||
| - name: Check commit messages | ||
| if: github.event_name == 'pull_request' | ||
| uses: ./check-commit-messages | ||
| with: | ||
| base_ref: ${{ github.event.pull_request.base.ref }} | ||
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,2 @@ | ||
| __pycache__/ | ||
| *.pyc |
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,11 @@ | ||
| # GitHub Actions | ||
|
|
||
| Shared GitHub Actions for Airlift projects. | ||
|
|
||
| ## Available actions | ||
|
|
||
| ### Check commit messages | ||
|
|
||
| Checks pull request commit titles, description wrapping, and attribution | ||
| trailers. See [check-commit-messages](check-commit-messages/README.md) for | ||
| usage and policy details. |
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,34 @@ | ||
| # Check commit messages | ||
|
|
||
| Checks every non-merge commit in a pull request. | ||
|
|
||
| ## Policy | ||
|
|
||
| - Commit titles should be at most 50 characters and must not exceed 60. | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| - Commit descriptions should wrap at 72 characters. Ordinary text must not | ||
| exceed 79 characters. | ||
| - `Assisted-by` and `Co-authored-by` trailers must not credit common AI models | ||
| or coding tools. Human attribution remains allowed. | ||
|
|
||
| Long URLs, recognized trailers, quoted text, fenced code blocks, and long | ||
| unwrappable tokens are exempt from description wrapping. | ||
|
|
||
| ## Usage | ||
|
|
||
| The action requires a checkout with complete history: | ||
|
|
||
| ```yaml | ||
| check-commit-messages: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - uses: airlift/github-actions/check-commit-messages@<commit-sha> # v1 | ||
| with: | ||
| base_ref: ${{ github.event.pull_request.base.ref }} | ||
| ``` | ||
|
|
||
| Consumers should pin the action to a complete commit SHA. | ||
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,22 @@ | ||
| name: Check commit messages | ||
| description: Check commit title length, description wrapping, and attribution trailers | ||
|
|
||
| inputs: | ||
| base_ref: | ||
| description: Pull request base branch | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Check commit messages | ||
| shell: bash | ||
| env: | ||
| BASE_REF: ${{ inputs.base_ref }} | ||
| run: | | ||
| if [[ ! "$BASE_REF" =~ ^[A-Za-z0-9._/-]+$ ]]; then | ||
| echo "Invalid pull request base ref: $BASE_REF" >&2 | ||
| exit 1 | ||
| fi | ||
| python3 "${{ github.action_path }}/check.py" \ | ||
| "origin/${BASE_REF}..HEAD" |
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.