From b3a4e35e36244ce8b1661dc245b9d23f5460ee88 Mon Sep 17 00:00:00 2001 From: Daniel Izdebski Date: Mon, 9 Oct 2023 18:08:29 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20chore(ci):=20Extract=20setup=20s?= =?UTF-8?q?tep=20to=20composite=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/setup.yml | 20 ++++++++++++++++++++ .github/workflows/pr.yml | 20 ++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 .github/actions/setup.yml diff --git a/.github/actions/setup.yml b/.github/actions/setup.yml new file mode 100644 index 000000000..969c341cd --- /dev/null +++ b/.github/actions/setup.yml @@ -0,0 +1,20 @@ +name: Setup + +description: | + Sets up the environment for the rest of the workflow. + +runs: + using: composite + steps: + - uses: pnpm/action-setup@v2 + with: + version: 8.7.6 + + - uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + registry-url: https://registry.npmjs.org + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 480fc2973..3d225bda2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,24 +11,8 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8.7.6 - - # Fetches the config package version from the `pnpm-lock.yaml` file. - - name: Fetch config package version - id: config-package-version - env: - GITMOJI_CONFIG_PACKAGE: "commitlint-config-gitmoji" - run: | - echo "CONFIG_PACKAGE=$(grep -A 2 "$GITMOJI_CONFIG_PACKAGE" pnpm-lock.yaml | awk '/version:/ {print "'"$GITMOJI_CONFIG_PACKAGE"'@" $2}')" >> "$GITHUB_OUTPUT" - - # Installs only the config package required for commitlint. - - name: Install config package - env: - CONFIG_PACKAGE: "${{ steps.config-package-version.outputs.CONFIG_PACKAGE }}" - run: | - pnpm add -w "$CONFIG_PACKAGE" + - name: Setup + uses: ./.github/actions/setup # The validation is done based on the `commitlint.config.js` file. - name: Validate PR title