diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-05 12:14:59 -0500 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2026-03-06 17:55:01 -0300 |
| commit | c27d368b92f321e6f91704f554dccbc18df5b075 (patch) | |
| tree | b92d6e2623213917e668f1ed84076b2da0077ae4 /.github | |
| parent | 9adc205b6d0269a81ce93a7e6d6b0f375f6bd526 (diff) | |
Extended checks and docs for proper commit message format and edition.
Thanks to Tim Schilling for the review.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Diffstat (limited to '.github')
| -rw-r--r-- | .github/pull_request_template.md | 2 | ||||
| -rw-r--r-- | .github/workflows/check_commit_messages.yml | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7efa2f1384..0d30fbbced 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,7 +16,7 @@ Provide a concise overview of the issue or rationale behind the proposed changes - [ ] This PR follows the [contribution guidelines](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/submitting-patches/). - [ ] This PR **does not** disclose a security vulnerability (see [vulnerability reporting](https://docs.djangoproject.com/en/stable/internals/security/)). - [ ] This PR targets the `main` branch. <!-- Backports will be evaluated and done by mergers, when necessary. --> -- [ ] The commit message is written in past tense, mentions the ticket number, and ends with a period. +- [ ] The commit message is written in past tense, mentions the ticket number, and ends with a period (see [guidelines](https://docs.djangoproject.com/en/dev/internals/contributing/committing-code/#committing-guidelines)). - [ ] I have checked the "Has patch" ticket flag in the Trac system. - [ ] I have added or updated relevant tests. - [ ] I have added or updated relevant docs, including release notes if applicable. diff --git a/.github/workflows/check_commit_messages.yml b/.github/workflows/check_commit_messages.yml index 32f1558464..590cc58de3 100644 --- a/.github/workflows/check_commit_messages.yml +++ b/.github/workflows/check_commit_messages.yml @@ -68,3 +68,39 @@ jobs: fi echo "✅ All commits have the required prefix." + + check-commit-suffix: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Fetch relevant branches + run: | + git fetch origin $BASE:base + git fetch origin pull/${{ github.event.pull_request.number }}/head:pr + + - name: Check commit messages suffix + run: | + COMMITS=$(git rev-list base..pr) + echo "Checking commit messages for trailing period" + FAIL=0 + for SHA in $COMMITS; do + MSG=$(git log -1 --pretty=%s $SHA) + echo "Checking commit $SHA: $MSG" + if [[ "${MSG: -1}" != "." ]]; then + echo "❌ Commit $SHA must end with a period." + echo "Refer to the guidelines linked in the PR checklist for commit message format." + echo "For how to rewrite commit messages, see https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/working-with-git/#editing-commit-messages" + FAIL=1 + fi + done + + if [[ $FAIL -eq 1 ]]; then + echo "One or more commit messages are missing a trailing period." + exit 1 + fi + + echo "✅ All commits have the required trailing period." |
