Skip to content

Collection of reusable GitHub Actions

License

Notifications You must be signed in to change notification settings

avocadowastaken/actions

Repository files navigation

avocadowastaken/actions

Checks

Collection of reusable GitHub Actions

npm/install

Features:

  • Install packages using npm, yarn or pnpm
  • Caches whole node_modules directory
  • Skips installation step when lockfile cache is hit
  • Automatically appends OS and Node version to the cache-key

Options:

  • working-directory – the default working directory
  • cache-key – an explicit key for restoring and saving the cache

Usage:

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    steps:
      - uses: actions/checkout@v3
      - uses: avocadowastaken/actions/npm/install@v2
      - run: npm test

Passing cache-key

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: [14, 16, 18]
        os: [ubuntu-latest, windows-latest]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - uses: avocadowastaken/actions/npm/install@v2
        with:
          cache-key: ${{ github.sha }}-
      - run: npm test

prepare-node-repo

Features:

Options:

  • working-directory – the default working directory
  • node-version – Node version specifier
  • cache-key – an explicit key for restoring and saving the cache

Usage:

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: [14, 16, 18]
        os: [ubuntu-latest, windows-latest]
    steps:
      - uses: avocadowastaken/actions/setup-node-repo@v2
        with:
          node-version: ${{ matrix.node }}
      - run: npm test

Passing cache-key

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: [14, 16, 18]
        os: [ubuntu-latest, windows-latest]
    steps:
      - uses: avocadowastaken/actions/setup-node-repo@v2
        with:
          cache-key: ${{ github.sha }}-
          node-version: ${{ matrix.node }}
      - run: npm test