Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] ability to push file but keep some files from deleting in the same folder #58

Closed
SooluThomas opened this issue Jan 22, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@SooluThomas
Copy link

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

@cpina cpina added the enhancement New feature or request label Jan 22, 2022
@cpina
Copy link
Owner

cpina commented Jan 22, 2022

Thanks, I will consider it, it's definitely a good idea. I'm trying to not add more features until I've written tests (#59) for the action. Otherwise it gets harder to test and too easy to make mistakes.

@cpina
Copy link
Owner

cpina commented Jan 22, 2022

Possible related: #30

@SooluThomas
Copy link
Author

@cpina I'm curious if source-branch: . would again wipe the directory or not

@cpina
Copy link
Owner

cpina commented Jan 25, 2022

@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).

@SooluThomas
Copy link
Author

SooluThomas commented Jan 25, 2022

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!

@cpina
Copy link
Owner

cpina commented Jan 26, 2022

👍 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

@cpina
Copy link
Owner

cpina commented Feb 24, 2022

Note to myself for when I implement this: to allow to keep all the files of the destination directory (perhaps in a different flag)

@dlankheet-fm
Copy link

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

@cpina
Copy link
Owner

cpina commented May 25, 2022

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.

TimDaub added a commit to neume-network/github-action-push-to-another-repository that referenced this issue Aug 24, 2022
@cpina
Copy link
Owner

cpina commented Sep 5, 2022

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).

@cpina cpina closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants