From 7aff9d4bcbd85384de989590f6571f8d464a9de8 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Wed, 11 Sep 2024 09:14:42 +0100 Subject: [PATCH] ci: add pr title validation check and types check --- .github/workflows/pull_request_checks.yml | 38 ++++++++++++++++++++--- package.json | 3 +- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index 8b45537..69e8fc1 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -17,13 +17,29 @@ jobs: - name: "๐Ÿงถ Setup Yarn Dependencies" uses: ./.github/actions/use-yarn-dependencies + ## + # validation + ## + + validate_pr_title: + name: "Validate PR Title" + needs: install + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v4 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies + - name: "โœ… Validate" + run: echo ${{ github.event.pull_request.title }} | yarn commitlint + ## # lint, build documentation, build package and test ## lint: name: "Lint" - needs: install + needs: [install, validate_pr_title] runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" @@ -33,9 +49,21 @@ jobs: - name: "๐Ÿ‘• Lint" run: yarn lint - build_documenation: + type_check: + name: "Type Check" + needs: [install, validate_pr_title] + runs-on: ubuntu-latest + steps: + - name: "๐Ÿ›Ž Checkout" + uses: actions/checkout@v4 + - name: "๐Ÿ”ง Setup" + uses: ./.github/actions/use-dependencies + - name: "๐Ÿ” Type Check" + run: yarn types:check + + build_documentation: name: "Build Documentation" - needs: install + needs: [install, validate_pr_title] runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" @@ -47,7 +75,7 @@ jobs: build_package: name: "Build Package" - needs: install + needs: [install, validate_pr_title] runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" @@ -59,7 +87,7 @@ jobs: test: name: "Test" - needs: install + needs: [install, validate_pr_title] runs-on: ubuntu-latest steps: - name: "๐Ÿ›Ž Checkout" diff --git a/package.json b/package.json index ab3ea3d..2af59a1 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "lint": "eslint . --ext .ts --ext .js", "prepare": "husky install", "prettier": "prettier --config .prettierrc --write \"**/*.{js,json,ts}\"", - "test": "jest" + "test": "jest", + "types:check": "tsc --noEmit --project tsconfig.build.json" }, "devDependencies": { "@commitlint/cli": "^18.6.0",