Skip to content
box

GitHub Action

persist-workspace

v2.0.0 Latest version

persist-workspace

box

persist-workspace

A action to persist your workspace across different jobs

Installation

Copy and paste the following snippet into your .yml file.

              

- name: persist-workspace

uses: bissolli/[email protected]

Learn more about this action in bissolli/gh-action-persist-workspace

Choose a version

gh-action-persist-workspace

This action will help you to persist your workspace from job to job on your workflow! With that you will be able to split your jobs and parallelize them without the need to re-do that basic steps needed for all the jobs.

Usage

This action use actions/upload-artifact and actions/download-artifact under the hood.

Persist the workspace

name: My CI

on:
  pull_request:

jobs:
  init:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - name: Install dependencies
        run: npm install
      - uses: bissolli/gh-action-persist-workspace@v2
        with:
          action: persist

Retrieve a persisted workspace

name: My CI

on:
  pull_request:

jobs:
  init:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - name: Install dependencies
        run: npm install
      - uses: bissolli/gh-action-persist-workspace@v2
        with:
          action: persist

  build:
    needs: [init]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
      - uses: chatfood/gh-action-persist-workspace@master
        with:
          action: retrieve
      - name: Build the project
        run: npm run build

Parallelize your jobs with the persisted workspace

name: My CI

on:
  pull_request:

jobs:
  init:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - name: Install dependencies
        run: npm install
      - uses: bissolli/gh-action-persist-workspace@v2
        with:
          action: persist

  test:
    needs: [init]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
      - uses: bissolli/gh-action-persist-workspace@v2
        with:
          action: retrieve
      - name: Run unit tests
        run: npm run test

  build:
    needs: [init]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
      - uses: bissolli/gh-action-persist-workspace@v2
        with:
          action: retrieve
      - name: Build the project
        run: npm run build

Accepted inputs

Input Type Default Description
action persist or retrieve persist Whether you would like to persist or retrieve the workspace.
artifactName string persisted-artifact Name of the generated artifact