Preserving build folder when using actions/checkout@v2

vicke4

I have a GitHub self-hosted runner set up to deploy a Next.js app that checkouts the repository, builds and restarts pm2.

The thing is whenever the actions/checkout@v2 step kicks in, it deletes all the files within the repository including the build folder .next that contains all the build files. This leads to the downtime of the application whenever the workflow runs.

I went through the source code of actions/checkout@v2, at the time of asking this question, in this file starting at line #109, the logic for deleting the contents of the directory is written. If my understanding is correct, I must have set up git-lfs to prevent the deletion of files. I have no need for git-lfs as of now.

I can submit a pull request to have a config which prevents the deletion of files within the directory. Am I missing something? Is there any workaround for this issue?

My current workflow file for more clarity,

name: Build & Deploy
defaults:
  run:
    shell: bash -l {0}

on:
  push:
    branches: master

jobs:
  build:
    runs-on: self-hosted

    steps:
     # This action deletes all my build files when it runs
      - uses: actions/checkout@v2
        with:
          clean: false

      - name: Install dependencies
        uses: bahmutov/npm-install@v1

      - name: Build
        run: npm run build

      - name: Deploy
        run: pm2 restart myApp || pm2 start npm --name "myApp" -- start
vicke4

This issue is fixed. Seems the config clean: false doesn't work the first time. More information is available in this GitHub issue comment.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Copying folder contents preserving the folder structure using powershell script

Next Js showing index of build folder when using serve

Add folder to bundle when build mac installer using javapackager

preserving both `this` references when using jQuery proxy

Preserving type when using Object.keys()

Preserving the order of an array when using .where in Rails

Preserving many columns when using gather

Preserving special characters when using requests module

Preserving newlines when using curl in a bash script

Preserving comma class when using dplyr package

Issue in preserving comments when merging 2 yamls using deepmerge python module and using ruamel.yaml

Use custom build output folder when using create-react-app

docker-compose - cannot use bind mount in folder created when using BUILD

Preserving non-numerical columns when using combn in R

Preserving NaN values when using groupby and lambda function on dataframe

Preserving "columns" when writing from a text file to excel using VBA

Preserving whitespace within XML elements between attributes when using XslCompiledTransform

Preserving Custom Object Types When Binding Using ng-model

Chrome Back button is not preserving the url history when using Ajax for pagination

Electron app Error when moving build folder

Trigger teamcity build when network folder changes

Using a flag for a specific folder in Grunt to build from

Using TFS to output build definitions bin folder on CI build

How can I copy a *.html file in /dist folder when using vue-cli-service build --target lib?

should we delete lib folder when we clean project in java and how to build it again after delete lib folder using apache ant and ivy

Errors in the build when using sencha app build

No apk folder in Build Folder

Zip content without preserving folder structure

Preserving folder structure in output directory with webpack