diff --git a/.github/workflows/conventional_commits.yml b/.github/workflows/conventional_commits.yml index 9778b0186ada4e84e76d39f6d83eb9f4af822e9b..7db4b72025d2982a6e3585f51d4e3abd02d13c4b 100644 --- a/.github/workflows/conventional_commits.yml +++ b/.github/workflows/conventional_commits.yml @@ -1,13 +1,25 @@ +# Enforces conventional commits on pull requests +# Ref: https://github.com/marketplace/actions/conventional-pull-request + name: Conventional Commits on: pull_request: branches: [main] + types: [opened, edited, synchronize] jobs: build: + if: "${{ !contains(github.event.pull_request.title, 'chore(main): release') }}" name: Conventional Commits runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: webiny/action-conventional-commits@v1.1.0 + - name: Validate + uses: CondeNast/conventional-pull-request-action@v0.2.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commitlintRulesPath: "./commitlint.config.js" + commitTitleMatch: "false" + ignoreCommits: "false" diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000000000000000000000000000000000000..3074fb28348d95a7708110b5ad4abe9df47889a5 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'subject-case': [2, 'always', 'sentence-case'], + 'subject-max-length': [2, 'always', 60], + 'type-enum': [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'style', 'test']], + }, +};