From a9ac5a5563bcc87ef5a58569ecc27e7396f91d9f Mon Sep 17 00:00:00 2001 From: Alexandre Teoi Date: Mon, 22 Jan 2024 09:54:33 -0300 Subject: [PATCH] feat: replace commitlint with gitlint (#12) --- .commitlintrc.json | 26 -------------------------- .github/workflows/ci.yml | 17 +++++++++++++++++ .github/workflows/commitlint.yml | 28 ---------------------------- .gitlint | 3 +++ 4 files changed, 20 insertions(+), 54 deletions(-) delete mode 100644 .commitlintrc.json create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/commitlint.yml create mode 100644 .gitlint diff --git a/.commitlintrc.json b/.commitlintrc.json deleted file mode 100644 index f4c1de1..0000000 --- a/.commitlintrc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "rules": { - "header-max-length": [ - 2, - "always", - 72 - ], - "type-enum": [ - 2, - "always", - [ - "docs", - "feat", - "fix", - "refactor", - "revert", - "style", - "test" - ] - ], - "type-empty": [ - 2, - "never" - ] - } -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fa18d4c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,17 @@ +name: CI +on: [push, pull_request] +jobs: + gitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install gitlint + run: pip install gitlint + - name: Validate current commit (last commit) with gitlint + if: github.event_name == 'push' + run: gitlint + - name: Validate PR commits with gitlint + if: github.event_name == 'pull_request' + run: gitlint --commits ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }},${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml deleted file mode 100644 index e95be4b..0000000 --- a/.github/workflows/commitlint.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI -on: [push, pull_request] -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install commitlint - run: | - npm install conventional-changelog-conventionalcommits - npm install commitlint@latest - - name: Print versions - run: | - git --version - node --version - npm --version - npx commitlint --version - - name: Get commit count - id: commit_count - run: echo "commit_count=$(git rev-list HEAD --count)" >>$GITHUB_OUTPUT - - name: Validate current commit (last commit) with commitlint - if: github.event_name == 'push' && steps.commit_count.outputs.commit_count > 1 - run: npx commitlint --from HEAD~1 --to HEAD --verbose - - name: Validate PR commits with commitlint - if: github.event_name == 'pull_request' - run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..d376911 --- /dev/null +++ b/.gitlint @@ -0,0 +1,3 @@ +[general] +ignore=body-is-missing +contrib=contrib-title-conventional-commits