Skip to content

A Github action to synchronize a monolithic repository to standalone repositories by using splitsh-lite.

License

Notifications You must be signed in to change notification settings

Davidmattei/subtree-splitter

 
 

Repository files navigation

subtree-splitter action

This actions synchronizes a monolithic repository to standalone repositories by using splitsh-lite.

Usage

Inputs

Specify using with keyword

  • config-path - (Required) Location of the subtree split mapping configuration
  • batch-size - How many subtreesplits should be processed in parallel. It is recommended to keep this amount low (or even at 1) for large repositories.

Example workflow

Configuration

Create a configuration file with the mapping of the different subtree splits. Each subtree split item contains a name (must be unique), directory in the current repository and a target git repository.

{
    "subtree-splits": [
        {
            "name": "core",
            "directory": "src/Core",
            "target": "[email protected]:example/core-package.git"
        }
    ]
}

Workflow

Example workflow to sync commits and tags.

on:
    push:
        # Only trigger for specific branches or changes in specific paths.
        branches:
            - '*'
        paths:
            - src/**
        # Tag push events should be ignored, they will be handled with the create event below.
        tags-ignore:
            - '*'
    create:
        tags:
            - '*'
    delete:
        tags:
            - '*'

jobs:
    sync_commits:
        runs-on: ubuntu-latest
        name: Sync commits
        if: github.repository == 'your-org/your-repository' # Execute this workflow job only on the main repository.
        steps:
            -   uses: actions/checkout@v2
                with:
                    persist-credentials: false
                    fetch-depth: 0

            # Add a personal access token to the repository secrets. This will allow the splitter action to push the new commits
            -   uses: frankdejonge/[email protected]
                with:
                    authentication: 'username:${{ secrets.PERSONAL_GITHUB_TOKEN }}'
                    user_name: 'Committer name'
                    user_email: 'Committer email'

            # Cache the splitsh executable to speedup future runs
            -   name: Cache splitsh-lite
                uses: actions/cache@v2
                with:
                    path: './splitsh'
                    key: '${{ runner.os }}-splitsh-v101'

            # Sync commits and tags for the configured subtree splits
            -   name: subtree split
                uses: acrobat/[email protected]
                with:
                    config-path: .github/subtree-splitter-config.json # Reference the location where you saved your config file

About

A Github action to synchronize a monolithic repository to standalone repositories by using splitsh-lite.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%