dmnemec / copy_file_to_another_repo_action

This GitHub Action copies a file from the current repository to a location in another repository
Apache License 2.0
182 stars 201 forks source link

Delete the destination folder before copying files #58

Open spleshka opened 2 years ago

spleshka commented 2 years ago

Hi,

The issue we faced with the current script is that if the destination input branch has a folder with files and the files being copied to the destination branch don't have some of the files from that folder (which is expected - some files can be removed on purpose), then the files are not being deleted. Our proposed solution is to make sure that the destination is empty before we copy the file(s) there.

pushkar4 commented 2 years ago

I wanted to mention that the reason we are using this action instead of https://github.com/cpina/github-action-push-to-another-repository is because this action does not delete the existing content inside the destination directory.

Our destination repo has a directory filled with yaml files which are monitored by ArgoCD for changes. New file means new deployment. Changed file means modify the existing deployment and delete file means tear down the deployment.

With this change we will end up tearing down all our existing deployments when trying to deploy a new one by pushing a new file.