Skip to content

Commit

Permalink
👷 chore(ci): Extract setup step to composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Oct 9, 2023
1 parent 9ff2201 commit b3a4e35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 2 additions & 18 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b3a4e35

Please sign in to comment.