From 3b43aad2f6215598e3c74bbd74ca126e3b815f57 Mon Sep 17 00:00:00 2001 From: abchen Date: Wed, 3 Apr 2024 22:46:34 +0800 Subject: [PATCH] =?UTF-8?q?build(cli):=20=20=E5=A2=9E=E5=8A=A0commitlint?= =?UTF-8?q?=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/commitlint.yaml | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/commitlint.yaml diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml new file mode 100644 index 0000000..ebdca71 --- /dev/null +++ b/.github/workflows/commitlint.yaml @@ -0,0 +1,36 @@ +name: CI + +on: [push, pull_request] + +jobs: + commitlint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install required dependencies + run: | + apt update + apt install -y sudo + sudo apt install -y git curl + curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - + sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs + - name: Print versions + run: | + git --version + node --version + npm --version + npx commitlint --version + - name: Install commitlint + run: | + npm install conventional-changelog-conventionalcommits + npm install commitlint@latest + + - name: Validate current commit (last commit) with commitlint + if: github.event_name == 'push' + run: npx commitlint --last --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 \ No newline at end of file