https://github.com/dipiash/pnpm-nx-reusable-action
Action for cache PNPM and NX dependencies / artifacts
https://github.com/dipiash/pnpm-nx-reusable-action
action github-actions monorepo monorepository nodejs nx pnpm
Last synced: about 1 month ago
JSON representation
Action for cache PNPM and NX dependencies / artifacts
- Host: GitHub
- URL: https://github.com/dipiash/pnpm-nx-reusable-action
- Owner: dipiash
- Created: 2022-04-20T16:59:17.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T17:16:40.000Z (over 1 year ago)
- Last Synced: 2026-03-11T10:41:40.750Z (3 months ago)
- Topics: action, github-actions, monorepo, monorepository, nodejs, nx, pnpm
- Homepage: https://github.com/dipiash/nx-ts-vite-react-graphql-styled-monorepo-example
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Action for cache PNPM and NX dependencies
## Cache paths
- ~/.pnpm-store
- **/node_modules
- node_modules/.cache/nx
## How to use
Real example you can see [here](https://github.com/dipiash/nx-ts-vite-react-graphql-styled-monorepo-example).
For example workflow action for PR checks.
```yaml
name: Check Pull Request
on:
push:
branches:
- main
pull_request:
jobs:
cache-and-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache data for pnpm and node_modules
uses: actions/cache@v3
with:
path: |
~/.pnpm-store
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.2.4
with:
version: 7.22.0
run_install: true
type-check:
runs-on: ubuntu-latest
needs:
- cache-and-install
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Reusable Action for PNPM and NX
uses: dipiash/pnpm-nx-reusable-action@v2
- name: type-check PR
if: github.ref != 'refs/heads/main'
run: npx nx affected --target=type-check --base=origin/main --head=HEAD --with-deps
- name: type-check Main
if: github.ref == 'refs/heads/main'
run: npx nx affected --target=type-check --base=origin/main~1 --head=origin/main --with-deps
```