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