github-action-push-to-another-repository
github-action-push-to-another-repository copied to clipboard
[request] ability to push file but keep some files from deleting in the same folder
The current workflow will automatically wipe all contents if no target-directory is mentioned. I'd like to request for a feature which allows some files to stay.
Something like ignore-files: "./README.md"
Thank you
Thanks, I will consider it, it's definitely a good idea. I'm trying to not add more features until I've written tests (https://github.com/cpina/github-action-push-to-another-repository/issues/59) for the action. Otherwise it gets harder to test and too easy to make mistakes.
Possible related: https://github.com/cpina/github-action-push-to-another-repository/issues/30
@cpina I'm curious if source-branch: . would again wipe the directory or not
@SooluThomas : I've had a look and it works as I had expected, but let me know if you expect something else, see something else or if the documentation is not clear.
If there is no target-directory: yes, it wipes out (but you can restore via git if you made a mistake) the destination repository. The reason is that initially there wasn't the target-directory option and when I added I kept the previous behaviour.
The source-directory is what is copied. Usually I have source-directory: output and output is where I have generated files via a previous step of the action. But if you do source-directory: . it copies (just tried) everything... including .github/worksflows/ci.ytml which might cause interesting effects :-) (the destination repo will have the action as well).
Currently there is no way to ignore files to not wipe them out. I plan to spend some time in Feburary (fingers crossed!) writing tests and then I might add more options. I don't promise which ones though. PR welcomed of course. I plan to really avoid new options until I've written tests to avoid regressions for existing users :-) (and stress on my side testing and fixing combinations of options).
~Thank you. I just realized that I asked the wrong question. So, do we have any workaround for making sure that some files in the target-directory are retained i.e., not deleted?~
I see that my question was already answered 😄
Currently there is no way to ignore files to not wipe them out. I plan to spend some time in Feburary (fingers crossed!) writing tests and then I might add more options. I don't promise which ones though. PR welcomed of course. I plan to really avoid new options until I've written tests to avoid regressions for existing users :-) (and stress on my side testing and fixing combinations of options).
Looking forward to the feature!
:+1: looking forward to implement it! :-) (don't expect it for quite a few weeks minimum).
At the moment a possible way is that you need to copy the files into the "source-directory" in the github action so they are copied across. For example with a command before the github-action-push-to-another-repository
Note to myself for when I implement this: to allow to keep all the files of the destination directory (perhaps in a different flag)
Dear cpina, thanks for the great script. I'm having the exact same problem now with my workflow files in the output repository. Did you consider to still add this?
Kind regards,
Daniel
Hi @dlankheet-fm - Yes, I want to implement it but I would like to write/prepare tests beforehand (last time that some features were added it broke something else and it's hard now to test everything properly). Sadly I haven't had time to do this as I thought.
If you would like to have this soon I think that for now taking care of the other files either in a different step as I mentioned (sorry, I don't have a final solution handy) or forking this action and fixing it for your usecase will be the faster way. Time is limited and need to work on other things and really want to avoid breaking other user's flow.
At neume-network we're also using this action and sparing some files from being deleted would help us:
- https://github.com/neume-network/data/blob/089cb1b25c95435ab04fe05aaa767aa5c9197d0f/.github/actions/run_step/action.yml#L68-L79
- https://github.com/neume-network/data/issues/26
I will close this issue because, hopefully, that can be done outside GitHub Action with a similar pattern as described in the FAQ: https://cpina.github.io/push-to-another-repository-docs/faq.html#how-can-i-copy-only-some-files-only-some-directories-exclude-some-files-etc
It might need copying files from the destination repository before hand. Is it a possibility for you?
I'm trying to avoid adding code if it could be done outside the action and also before writing automated tests (#59) to avoid regressions.
If not possible please re-open the issue and I will try to think if it could be done outside GitHub Action.
Another option is to fork and change the script for your case (I know, not ideal).