From 8cf7d7981cdcb8e79892a1032f42a0bdea7d477e Mon Sep 17 00:00:00 2001 From: Shamitha Shashidhara Date: Wed, 27 Nov 2024 15:59:11 +0530 Subject: [PATCH] ci: Add automatic check for commit message format - Add GitHub Actions workflow to lint commit messages on push and pull request events. - Create custom commitlint configuration file (.commitlintrc.json) to enforce commit message standards. - Document commit message format in CONTRIBUTING.md Signed-off-by: Shamitha Shashidhara --- .commitlintrc.json | 26 +++++ .github/workflows/commit-message-format.yml | 16 +++ CONTRIBUTING.md | 5 + doc/learning/commitmessage/index.rst | 111 ++++++++++++++++++++ doc/learning/overview.rst | 1 + 5 files changed, 159 insertions(+) create mode 100644 .commitlintrc.json create mode 100644 .github/workflows/commit-message-format.yml create mode 100644 doc/learning/commitmessage/index.rst diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 00000000000..22d034d3188 --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,26 @@ +{ + "rules": { + "type-enum": [1, "always", [ + "Build", + "Ci", + "Docs", + "Feat", + "Fix", + "Perf", + "Refactor", + "Revert", + "Style", + "Test" + ]], + "header-full-stop": [2, "never"], + "header-trim": [2, "always"], + "subject-empty": [1, "never"], + "subject-full-stop": [2, "never", "."], + "subject-max-length": [1, "always", 72], + "subject-case": [2, "always", "sentence-case"], + "body-leading-blank": [2, "always"], + "body-max-line-length": [1, "always", 72], + "body-case": [1, "always", "sentence-case"], + "signed-off-by": [1, "always", "Signed-off-by:"] + } + } \ No newline at end of file diff --git a/.github/workflows/commit-message-format.yml b/.github/workflows/commit-message-format.yml new file mode 100644 index 00000000000..b1b9ddb1489 --- /dev/null +++ b/.github/workflows/commit-message-format.yml @@ -0,0 +1,16 @@ +name: Check Commit Message Format + +on: [push, pull_request] + +jobs: + commitmessage: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Commit message format + uses: wagoid/commitlint-github-action@v5 + with: + configFile: .commitlintrc.json \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 234be252fb6..5d99d08241f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,6 +43,11 @@ To contribute your work you need to... 4. Push to the Branch (`git push origin newBranchName`) 5. Open a Pull Request +### Commit Message Format + +For detailed commit message guidelines, see the +[Commit Message Format](https://eclipse-openbsw.github.io/openbsw/sphinx_docs/doc/learning/commitmessage/index.rst). + ## Eclipse Contributor Agreement Before your contribution can be accepted by the project team contributors must diff --git a/doc/learning/commitmessage/index.rst b/doc/learning/commitmessage/index.rst new file mode 100644 index 00000000000..2eb8f0bb2a0 --- /dev/null +++ b/doc/learning/commitmessage/index.rst @@ -0,0 +1,111 @@ +Commit Message Format +===================== + +We have very precise rules over how our Git commit messages must be formatted. +This format leads to **easier to read commit history**. +Each commit message consists of a **header**, a **body**, and a **footer**. + +.. code-block:: text + +
+ + + +