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

Exclude files to be deleted when files are copied #107

Open
D3vil0p3r opened this issue Jul 9, 2023 · 2 comments
Open

Exclude files to be deleted when files are copied #107

D3vil0p3r opened this issue Jul 9, 2023 · 2 comments

Comments

@D3vil0p3r
Copy link

D3vil0p3r commented Jul 9, 2023

Thank you for your project.

I'm using it for copying compiled documentation files (from .md to .html by Astro Starlight) from a source repository to a public one.

This public one should contain not only the built source files but also a CNAME file created by GitHub page when I set the subdomain docs.mysite.org in the settings of the public repo.

The problem is that, when the files of the source-directory are copied to the target-directory, all the files in the target-directory seem to be deleted before the copy because my CNAME file disappears and I need to create a new one manually. Is there a way to add an argument like exclude-file to exclude one or more files in a specific path from deletion?

Or just make the copy action to not delete the already stored files in the target directory, just overwrite the ones with the same name (could be better).

@cpina
Copy link
Owner

cpina commented Jul 9, 2023

I'll have limited connection (mountain hiking and then holidays) next week, I might not follow up quickly.

At the moment it's deleting the the destination repository "by design" :-) I'm avoiding adding too many flags / configuration to keep maintenance low.

An immediate solution might be to fork the github action and make the changes that you need. Perhaps before the line rm -rf "$ABSOLUTE_TARGET_DIRECTORY" you could copy the file out from the destination repo (it's already cloned at that point) and then copy it back after the step echo "[+] Copying contents... (I cannot think now if deleting the "rm" would help, I think that there might need to be more changes if you did this!).

I know that is not ideal!

I'll see if I come up with a better idea when I'm back! (I avoid copying things doing 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 but this would delete the file).

Also, I know that there are other similar github actions to do similar things to do this one, and some might have what you need! have a look! (no harm in using another one, feel free to comment here in case that it is helpful).

@cpina cpina transferred this issue from cpina/push-to-another-repository-docs Jul 9, 2023
@mikeage
Copy link

mikeage commented Apr 7, 2024

I'm not the OP, but if you're willing to reconsider adding a flag for this, I'd find it personally very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants