Skip to content

Sparrowworks/sync-repos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sync Repos Action

Sync Repos Action is a GitHub Action designed to synchronize files or directories across multiple repositories. This action is particularly useful for maintaining consistency across various repos by automatically propagating changes from a source path to a target path in different repositories.

Usage

This action can be referenced in your workflow file with:

- uses: AzulGarza/sync-repos@main
  with:
    target-repo: target/repo
    target-path: target/path
    source-path: source/path
    branch-name: new-branch
    github-token: ${{ secrets.GITHUB_TOKEN }}
    commit-message: 'Commit message'
    base-branch: main
    label: documentation
    user-email: [email protected]
    user-name: username

Replace parameters as needed.

Inputs

This action requires the following inputs:

  • target-repo: The GitHub repository where the files or directories need to be updated. (required)

  • target-path: The path of the target file or directory in the target repository where the changes need to be reflected. This can be a file or a directory. (required)

  • source-path: The local path of the file or directory that contains the changes to be propagated. This can be a file or a directory. (required)

  • branch-name: The name of the new branch to be created for the changes. (required)

  • github-token: A GitHub token with appropriate permissions to create and manage PRs. Typically, you would use the GitHub provided secrets.GITHUB_TOKEN. (required)

  • commit-message: The message for the commit that includes the changes. (required)

  • base-branch: The branch that the changes should be based off of. If not provided, defaults to 'main'. (optional)

  • label: The labels to be applied to the PR for better categorization. Defaults to 'documentation' if not provided. (optional)

  • user-email: The email address associated with the GitHub account performing the action. This will be used to associate the commits and pull request with this user. (required)

  • user-name: The username of the GitHub account performing the action. This will be reflected in the commits and pull request. (required)

Outputs

This action does not have any outputs. However, successful execution will result in a pull request being created on the target repository with the propagated changes.

Example Workflow

Here's an example of how you might use this action in a workflow:

name: Sync Repos Workflow
on:
  push:
    branches:
      - main

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

      - name: Sync Repos
        uses: AzulGarza/sync-repos@main
        with:
          target-repo: target/repo
          target-path: target/path
          source-path: source/path
          branch-name: sync-branch
          github-token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: 'Sync files'
          base-branch: main
          label: sync
          user-email: [email protected]
          user-name: username

Remember to replace the placeholders with actual values.

Questions or Issues

If you have any questions or face any issues, please open a new issue in the action repository.

About

Github action to sync files among multiple repos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published