diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000000..5f27bae4a2 --- /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", 50], + "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 0000000000..b1b9ddb148 --- /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 234be252fb..09e7e295d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,6 +43,104 @@ To contribute your work you need to... 4. Push to the Branch (`git push origin newBranchName`) 5. Open a Pull Request +### 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**. + +``` +
+ + + +