From a2b8a073cc7630504430aa9a7b94ec77799d5bdd Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 29 Nov 2023 09:51:14 +0000 Subject: [PATCH] ci: pr title lint job does not need to install all dependencies (#5124) --- .github/workflows/pr-title-lint.yml | 9 +++++--- .../commitlint/.commitlintrc.json | 0 tools/commitlint/README.md | 3 +++ tools/commitlint/package.json | 10 +++++++++ yarn.lock | 22 +++++++++++++++++++ 5 files changed, 41 insertions(+), 3 deletions(-) rename .commitlintrc.json => tools/commitlint/.commitlintrc.json (100%) create mode 100644 tools/commitlint/README.md create mode 100644 tools/commitlint/package.json diff --git a/.github/workflows/pr-title-lint.yml b/.github/workflows/pr-title-lint.yml index 75ecb019bf..283a1048c7 100644 --- a/.github/workflows/pr-title-lint.yml +++ b/.github/workflows/pr-title-lint.yml @@ -19,7 +19,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Node.js - uses: ./.github/actions/setup-node + uses: actions/setup-node@v3 with: - electron-install: false - - run: echo "${{ github.event.pull_request.title }}" | yarn dlx commitlint -g ./.commitlintrc.json + cache: 'yarn' + node-version-file: '.nvmrc' + - name: Install dependencies + run: yarn workspaces focus @affine/commitlint-config + - run: echo "${{ github.event.pull_request.title }}" | yarn workspace @affine/commitlint-config commitlint -g ./.commitlintrc.json diff --git a/.commitlintrc.json b/tools/commitlint/.commitlintrc.json similarity index 100% rename from .commitlintrc.json rename to tools/commitlint/.commitlintrc.json diff --git a/tools/commitlint/README.md b/tools/commitlint/README.md new file mode 100644 index 0000000000..34ee016ab5 --- /dev/null +++ b/tools/commitlint/README.md @@ -0,0 +1,3 @@ +# commitlint + +This package defines commitlint and it's dependencies, so that it can be used in a CI pipeline to minimize the installation time. diff --git a/tools/commitlint/package.json b/tools/commitlint/package.json new file mode 100644 index 0000000000..6a47516f4b --- /dev/null +++ b/tools/commitlint/package.json @@ -0,0 +1,10 @@ +{ + "name": "@affine/commitlint-config", + "version": "0.0.0", + "private": true, + "devDependencies": { + "@commitlint/cli": "^18.4.3", + "@commitlint/config-conventional": "^18.4.3", + "commitlint": "^18.4.3" + } +} diff --git a/yarn.lock b/yarn.lock index edfee1f4c1..1082ad531c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -204,6 +204,16 @@ __metadata: languageName: unknown linkType: soft +"@affine/commitlint-config@workspace:tools/commitlint": + version: 0.0.0-use.local + resolution: "@affine/commitlint-config@workspace:tools/commitlint" + dependencies: + "@commitlint/cli": "npm:^18.4.3" + "@commitlint/config-conventional": "npm:^18.4.3" + commitlint: "npm:^18.4.3" + languageName: unknown + linkType: soft + "@affine/component@workspace:*, @affine/component@workspace:packages/frontend/component": version: 0.0.0-use.local resolution: "@affine/component@workspace:packages/frontend/component" @@ -17671,6 +17681,18 @@ __metadata: languageName: node linkType: hard +"commitlint@npm:^18.4.3": + version: 18.4.3 + resolution: "commitlint@npm:18.4.3" + dependencies: + "@commitlint/cli": "npm:^18.4.3" + "@commitlint/types": "npm:^18.4.3" + bin: + commitlint: cli.js + checksum: e37da4f1cd218381a7810b2e74a553bd05b01776d76dc3038b6e805ea6640308dfa0372c2a976ab5d8c34577128fe6df945e4718c27732dd0d79b517f066fee5 + languageName: node + linkType: hard + "common-path-prefix@npm:^3.0.0": version: 3.0.0 resolution: "common-path-prefix@npm:3.0.0"