Skip to content

Git action to clone a repository, or repository path, to a new or existing repository.

License

Notifications You must be signed in to change notification settings

Bits-To-Breath/git-get-cloned-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Git Get Cloned Logo

Git Get Cloned Action

Github Action for copying files to other repositories, in an easy and repeatable way.

Inspiration

Support services

  • GitHub

Usage

The following workflow example will use as many default options as possible. It will clone the current repository running the github action into a new repository using a simple workflow.

    - name: Clone
      uses: Bits-To-Breath/git-get-cloned-action@latest
      with:
        source_auth_id: Bits-To-Breath
        source_auth_token: ${{ secrets.PERSONAL_TOKEN }}
        destination_owner: Bits-To-Breath
        destination_repo_name: example-temp

Features

  • Clone a repository; create new source and destination repository if they do not yet exist
  • Clone with two perl regexes for filtering specific files and folders to select and then ignore
  • Clone specific repository source to specific repository destination (unrelated to repository workflow is running from)
  • Clone paths for specific parts of the repository to be cloned to specific destinations
  • Clone optionally with separate credentials for source and destination repositories
  • Clone wiki additionally if needed
  • Clone specific branch at source and to specific destination branch, with specific default branch at source and destination; creates new branches, derived from the default branch if possible
  • Clone using specific commit message, email and username (username should pair with the access token)

Common Mistakes and Pitfalls

  • Invalid regexes, please make use of https://regex101.com/ to test your full paths againt your custom regex. Disabling global and multiline is recommended.
  • If using destination_clean please be careful how you use it, it will clear out your destination repository where you will likely need to revert commits.
  • Please look below at Options or use action.yml to view all the available options.
  • Please note the wiki path is exclusive from the repository source and destination paths.

Options ⚙️

The following is the exhaustive list of options:

Input variable Necessity Description Default
source_auth_id Required The authentication id of the source repository. For example oauth2 or Bits-To-Breath.
source_auth_token Required The authentication token of the source repository.
destination_owner Required The owner of the destination repository; organization or user.
destination_repo_name Required The destination repository name.
select_regex Optional The select regex chooses files or folders, using regexe(s), to collect. (.*)
ignore_regex Optional The ignore regex chooses files or folders, using regexe(s), to collect. (.*\/\.git\/.*)
commit_message Optional The message to show during automated commits. (brief summary string with timestamp)
commit_username Optional The message to show during automated commits. ${GITHUB_ACTOR}
commit_email Optional The message to show during automated commits. ${COMMIT_USERNAME}@users.noreply.github.com
source_is_private Optional The source repository is private. true
source_is_template Optional The source repository is template. false
source_service Optional The source repository service. github.com
source_owner Optional The owner of the source repository; organization or user. $GITHUB_REPOSITORY_OWNER
source_repo_name Optional The source repository name. ${GITHUB_REPOSITORY#*/}
source_branch Optional The source branch to collect files from. main
source_default_branch Optional The source default branch to collect files from. main
source_path Optional The source path in the repository to collect files from.
source_wiki Optional The source wiki path.
destination_is_private Optional The destination repository is private. true
destination_is_template Optional The destination repository is template. false
destination_service Optional The destination repository service. github.com
destination_path Optional The path to put the source files.
destination_branch Optional The destination branch to collect files from. main
destination_default_branch Optional The destination default branch to collect files from. main
destination_path Optional The destination path in the repository to collect files from.
destination_wiki Optional The destination wiki path.
code_env Optional The code environment; may become an relevant feature in future. pre-dev is used for locally development.

Contributing

Steps for testing locally

  1. Clone this repository.
  2. create .env from .example.env
  3. populate .env with your information
  4. begin editing entrypoint.sh
  5. type bash or zsh to start another terminal inside your current terminal
  6. type . ./load_env.sh to load all the required variables
  7. type . ./entrypoint.sh to run the code
  8. begin making your changes to fix bugs or add features

Author

The Git Get Cloned Action is written by Austin Hogan ausgan.93+bitstobreath.com@gmail.com

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Git action to clone a repository, or repository path, to a new or existing repository.

Resources

License

Stars

Watchers

Forks

Packages

No packages published