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
183 stars 206 forks source link
hacktoberfest

copy_file_to_another_repo_action

This GitHub Action copies a file from the current repository to a location in another repository

Example Workflow

name: Push File

on: push

jobs:
  copy-file:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Pushes test file
      uses: dmnemec/copy_file_to_another_repo_action@main
      env:
        API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
      with:
        source_file: 'test2.md'
        destination_repo: 'dmnemec/release-test'
        destination_folder: 'test-dir'
        user_email: 'example@email.com'
        user_name: 'dmnemec'
        commit_message: 'A custom message for the commit'

Variables

The API_TOKEN_GITHUB needs to be set in the Secrets section of your repository options. You can retrieve the API_TOKEN_GITHUB here (set the repo permissions).

Behavior Notes

The action will create any destination paths if they don't exist. It will also overwrite existing files if they already exist in the locations being copied to. It will not delete the entire destination repository.