From 71300634850cb0f24391fb2138a3e3c10d34604a Mon Sep 17 00:00:00 2001 From: lingbopro Date: Sat, 7 Dec 2024 18:35:18 +0800 Subject: [PATCH] ci: add commitlint & code check workflows --- .github/workflows/code-check.yaml | 29 +++++++++++++++++++++++++++++ .github/workflows/commitlint.yaml | 18 ++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/code-check.yaml create mode 100644 .github/workflows/commitlint.yaml diff --git a/.github/workflows/code-check.yaml b/.github/workflows/code-check.yaml new file mode 100644 index 0000000..87fd075 --- /dev/null +++ b/.github/workflows/code-check.yaml @@ -0,0 +1,29 @@ +name: Code Check + +on: + push: + pull_request: + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + prettier: + name: Prettier Check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run Prettier + id: prettier-run + uses: rutajdash/prettier-cli-action@v1.0.2 + with: + config_path: ./.prettierrc + - name: Prettier Output + if: ${{ failure() }} + shell: bash + run: | + echo "The following files are not formatted:" + echo "${{steps.prettier-run.outputs.prettier_output}}" diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml new file mode 100644 index 0000000..aabbfb9 --- /dev/null +++ b/.github/workflows/commitlint.yaml @@ -0,0 +1,18 @@ +name: Commitlint + +on: + push: + pull_request: + +jobs: + commitlint: + name: Commitlint + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + sparse-checkout: | + commitlint.config.js + - name: Run commitlint + uses: dafnik/commitlint@v1