s0 / git-publish-subdir-action

GitHub Action to push a subdirectory as a branch to any git repo (e.g. for GitHub Pages)
https://github.com/marketplace/actions/push-git-subdirectory-as-branch
MIT License
208 stars 36 forks source link

[bug?] `CLEAR_GLOBS_FILE` doesn't seem to work #57

Closed keunes closed 2 years ago

keunes commented 2 years ago

Hello!

Thank you for this GitHub action! I'm using it for the website of the FOSS podcast app AntennaPod.

I didn't understand why the whole target branch was wiped, until I read the README about Custom clear operations.

I created the file .github/workflows/.clear-target-files with the following contents:

!translations/contribute-pages/*
!translations/documentation-pages/*
!translations/general-pages/*
!translations/general-strings/*

However, none of the files I manually created in the target branch are actually deleted. I would expect the following items in the target items to be deleted:

translations/contribute/site-contribute_nl.po
translations/testing.md

The behaviour of the action is as if the CLEAR_GLOBS_FILE is empty, in which case target branch is not cleared at all. Could this be a bug?

keunes commented 2 years ago

I saw this code in the PR introducing the feature. So I added

**/*
!.git

to my .clear-target-files file, and now it works as expected :)

I'm wondering if there should be a setting allowing to choose between 'wipe all except what is in CLEAR_GLOBS_FILE' and 'wipe only items listed in CLEAR_GLOBS_FILE'.

s0 commented 2 years ago

Perhaps the README is not clear enough that using CLEAR_GLOBS_FILE replaces the default behavior of clearing everything, I'll clarify the documentation to make it clear that's the case, but I don't think adding another option will be the right solution, as it will complicate the code unnecessarily, given it's already configurable adding the lines you've written (which i'll also add to the README)