diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 000000000..4467c7516 --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,7 @@ +{ + "extends": ["@commitlint/config-conventional"], + "rules": { + "subject-case": [0], + "body-max-line-length": [0] + } +} diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml index fb196be99..668d04d7c 100644 --- a/.github/workflows/create-github-release.yml +++ b/.github/workflows/create-github-release.yml @@ -31,6 +31,6 @@ jobs: node-version: 20 - name: Perform release - run: npx --package @semantic-release/exec semantic-release + run: npx --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release env: GH_TOKEN: ${{ steps.get_access_token.outputs.token }} diff --git a/.github/workflows/pr-linting.yml b/.github/workflows/pr-linting.yml index c175b8031..a77e04755 100644 --- a/.github/workflows/pr-linting.yml +++ b/.github/workflows/pr-linting.yml @@ -1,5 +1,8 @@ name: PR Linting +permissions: + contents: read + on: pull_request: types: [opened, reopened, synchronize] @@ -13,4 +16,23 @@ jobs: uses: actions/checkout@v4 - name: MegaLinter - uses: oxsecurity/megalinter/flavors/documentation@v9 \ No newline at end of file + uses: oxsecurity/megalinter/flavors/documentation@v9 + + commitlint: + runs-on: ubuntu-latest + name: Conventional Commit Validation + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Validate PR commits with commitlint + run: | + npm install --no-save @commitlint/cli @commitlint/config-conventional + npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose \ No newline at end of file diff --git a/.releaserc b/.releaserc index 225c1daaf..8410a5510 100644 --- a/.releaserc +++ b/.releaserc @@ -21,6 +21,11 @@ } ], "@semantic-release/github", - "@semantic-release/commit-analyzer" + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits" + } + ] ] }