Home > other >  PNPM Github actions flow
PNPM Github actions flow

Time:12-22

I just moved my project from npm and lerna to pnpm but now when using GitHub actions I get the following error

"line 1: pnpm: command not found"

can someone suggest how the .yml file should be, I've posted the current version below?

name: Lint & Unit Test

on: [pull_request]

jobs:
  run-linters:
    name: Run linter and Unit tests
    runs-on: ubuntu-latest

    steps:
      - name: Check out Git repository
        uses: actions/checkout@v3

      - name: ACTIONS_ALLOW_UNSECURE_COMMANDS
        run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 16.18.1

      - name: Portal Install Node.js dependencies
        working-directory: ./portals
        run: |
          pnpm install

      - name: Portals Lint & tests
        working-directory: ./portals
        run: |
          cat .env.example > .env
          pnpm run build:tailwind
          pnpm run lint
          pnpm test

      - name: Services Install Node.js dependencies
        working-directory: ./services
        run: |
          pnpm install

      - name: Services Lint & tests
        working-directory: ./services
        run: |
          pnpm run lint
          pnpm test

CodePudding user response:

You might need to use first the pnpm/action-setup action, in order to install pnpm.

on:
  - push
  - pull_request

jobs:
  install:
    runs-on: ubuntu-latest

    steps:
      - uses: pnpm/action-setup@v2
        with:
          version: 6.0.2
  • Related