Skip to content

Add support for single file transfer without clearing target directory #118

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

imlolman
Copy link

Currently, when transferring content to another repository, the action clears the entire target directory before copying new content. This can be problematic when you want to preserve existing files in the destination directory and only update specific files.

Changes Made

  • Added new input parameters:
    • source-file: Path to the source file to transfer
    • target-file: Destination path in the target repository
  • Modified the entrypoint script to support two modes:
    1. Directory transfer (existing behavior)
    2. Single file transfer (new feature)
  • When using single file transfer:
    • Target directory is not cleared
    • Only the specified file is copied
    • Parent directories are created if they don't exist

Example Usage

  uses: cpina/github-action-push-to-another-repository@main
  with:
   source-file: 'path/to/source/file.txt'
   target-file: 'path/in/destination/file.txt'
   # ... other required parameters ...

Benefits

  • Allows selective file transfers without affecting other files
  • Preserves existing content in destination repository
  • More granular control over file transfers

Testing Done

  • Verified file transfer works without clearing target directory
  • Confirmed creation of parent directories if needed
  • Tested error handling for non-existent source files

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

Successfully merging this pull request may close these issues.

1 participant