From b6463e9a3e07b3c6012aa3939c126eba9706b1a3 Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Mon, 18 Dec 2023 21:03:09 +0100 Subject: [PATCH] chore(ci): add PR checks --- .github/workflows/validate.yml | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000..a8b5a423 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,47 @@ +name: Validate +on: + pull_request: + types: [ opened, reopened, synchronize ] + +permissions: + contents: read # for checkout + +jobs: + lint: + name: Check code format + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + - name: Install dependencies + run: yarn install + - name: Prepare environment + run: yarn lint:check + commits: + name: Check commits + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + - name: Install dependencies + run: yarn install -g @commitlint/cli @commitlint/config-conventional + - name: Configure + run: | + echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js + - name: Validate + run: | + git fetch + 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