diff --git a/.github/workflows/conventional-commit.yml b/.github/workflows/conventional-commit.yml new file mode 100644 index 000000000..9810c3eba --- /dev/null +++ b/.github/workflows/conventional-commit.yml @@ -0,0 +1,15 @@ +name: Conventional Commits + +on: + pull_request: + branches: [ main ] + +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Conventional Commit + uses: webiny/action-conventional-commits@v1.1.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..eed47e096 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: + - repo: https://github.com/compilerla/conventional-pre-commit + rev: v2.4.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] + args: [] # optional: list of Conventional Commits types to allow e.g. [feat, fix, ci, chore, test] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2567c009e..8d84c4832 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,6 +74,30 @@ You should follow the basic GitHub workflow: Refer to [containerd's contribution guide](https://github.com/containerd/project/blob/master/CONTRIBUTING.md#successful-changes) for tips on creating a successful contribution. +## Commit Formatting + +This project adheres to [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#specification) for commit formatting. To make adhering to Conventional Commit easier [pre-commit](https://pre-commit.com/) can be used to validate commit messages before they are created. To install the [pre-commit](https://pre-commit.com/) and the git hook please run the following commands: + +### Install pre-commit + +```bash +pip install pre-commit +``` + +Or on Mac: + +```bash +brew install pre-commit +``` + +For more options please see the pre-commit [installation instructions](https://pre-commit.com/#install) + +### Install the git hook + +```bash +pre-commit install +``` + ## Sign your work The sign-off is a simple line at the end of the explanation for the patch. Your