diff --git a/.github/commitlint.config.js b/.github/commitlint.config.js new file mode 100644 index 0000000000..cf7daab867 --- /dev/null +++ b/.github/commitlint.config.js @@ -0,0 +1,44 @@ +module.exports = { + rules: { + 'header-max-length': [2, 'always', 72], + 'type-case': [2, 'always', 'lower-case'], + 'type-empty': [2, 'never'], + 'type-enum': [ + 2, + 'always', + [ + 'babeld', + 'bfdd', + 'bgpd', + 'doc', + 'docker', + 'eigrpd', + 'fpm', + 'isisd', + 'ldpd', + 'lib', + 'multi', + 'nhrpd', + 'ospf6d', + 'ospfd', + 'pbrd', + 'pimd', + 'pim6d', + 'ripd', + 'ripngd', + 'sharpd', + 'staticd', + 'tests', + 'tools', + 'vtysh', + 'vrrpd', + 'yang', + 'zebra', + 'all', + ], + ], + 'subject-empty': [2, 'never'], + 'subject-full-stop': [2, 'never', '.'], + 'subject-case': [2, 'always', 'sentence-case'], + }, +}; diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000000..a1f273a2ce --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,19 @@ +name: commitlint + +on: + pull_request_target: + types: + - opened + - reopened + +jobs: + lint: + if: github.repository == 'frrouting/frr' + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Check Commit + uses: wagoid/commitlint-github-action@v5 + with: + configFile: .github/commitlint.config.js diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst index 06a2ccbc0a..f496906101 100644 --- a/doc/developer/workflow.rst +++ b/doc/developer/workflow.rst @@ -342,6 +342,46 @@ summary of the included patches. The description should provide additional details that will help the reviewer to understand the context of the included patches. +Squash commits +-------------- + +Before merging make sure a PR has squashed the following kinds of commits: + +- Fixes/review feedback +- Typos +- Merges and rebases +- Work in progress + +This helps to automatically generate human-readable changelog messages. + +Commit Guidelines +----------------- + +There is a built-in commit linter. Basic rules: + +- Commit messages must be prefixed with the name of the changed subsystem, followed + by a colon and a space and start with an imperative verb. + + `Check `_ all + the supported subsystems. + +- Commit messages must start with a capital letter +- Commit messages must not end with a period ``.`` + +Why was my pull request closed? +------------------------------- + +Pull requests older than 180 days will be closed. Exceptions can be made for +pull requests that have active review comments, or that are awaiting other +dependent pull requests. Closed pull requests are easy to recreate, and little +work is lost by closing a pull request that subsequently needs to be reopened. + +We want to limit the total number of pull requests in flight to: + +- Maintain a clean project +- Remove old pull requests that would be difficult to rebase as the underlying code has changed over time +- Encourage code velocity + .. _license-for-contributions: License for Contributions