Fix remove not working properly#336
Conversation
|
I encountered this bug also #337, i hope this will be merged |
|
Thanks for the proposed fix, @sunghwan2789. Can you please remove the added |
|
Oh I did not notice that. Removed now! |
| remote: 'origin', | ||
| src: '**/*', | ||
| only: '.', | ||
| remove: '.', |
There was a problem hiding this comment.
This default scares me. I haven't found time to do a more thorough review, but I don't get why we would want to remove everything by default.
There was a problem hiding this comment.
Scratch that, I see that is the currently documented behavior. Clearly I need to get my head back into this before understanding if this change does the right thing.
There was a problem hiding this comment.
I think removing all files default seems ok to me, as options.add is present for controlling this behaviour.
For a reference, please take a look https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-keeping-existing-files
|
Thanks for your work on this, @sunghwan2789. |
This PR fixes some issues described below and resolves #334, fixes #337 .
Remove globbed files
gh-pages/lib/index.js
Line 156 in 3579ab2
Joining files in a string causes incorrect shell argument passing. A globbed file can be removed, but globbed files cannot be removed since the actual command will be
This PR makes
git.rmandgit.addacceptstring[]and handle them properly.Remove files in remote dist directory, not in local one
gh-pages/lib/index.js
Lines 97 to 99 in 3579ab2
This shows that gh-pages globs files to be removed in local dist directory, not in remote branch. It causes git a fatal error(like #337) since it tries to remove files that are not in remote dist directory.
globby.syncshould be executed in remote dist directory.Skip removing files if there are no globbed files
When
globby.syncglobs files, it returns empty array if there are no files to be removed. A guard of it should be added beforegh-pages/lib/index.js
Line 156 in 3579ab2