This GitHub Action enables you to synchronize the latest changes from another repository, streamlining your development process.
To use this GitHub Action, add the following YAML code to your workflow file (e.g., .github/workflows/git-sync.yml
):
name: Git Sync
on:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
branch: main # Branch to sync in
- name: Git Sync
uses: 90dy/gha-git-sync@v1
with:
repository: '' # Repository to pull from
branch: '' # Branch to sync from
user-email: '' # Git user email
user-name: '' # Git user name
paths: | # File path to sync (not directories)
file-a.txt
file-b.txt
commit-message: '' # Commit message
assignees: '' # A comma or newline-separated list of assignees (GitHub usernames)
remote: '' # The name of the remote to fetch from.
You can configure the following inputs based on your requirements:
repository
: The repository to pull changes from.branch
: The branch to sync.user-email
: Your Git user email.user-name
: Your Git user name.paths
: (Optional) File path to sync (not directories).commit-message
: (Optional) Commit message.assignees
: (Optional) A comma or newline-separated list of assignees (GitHub usernames).remote
: (Optional)` The name of the remote to fetch from.
- Set the committer information in the Git configuration.
- Fetch the changes from the specified repository and branch.
- Checkout to a branch where to make change.
- Attempt to rebase the changes.
- If the rebase is successful, merge the changes into the current branch.
- If the merge is successful, push the changes to the current branch.
- If the rebase fails, abort the process.
- If the abort is successful, create a pull request to sync the changes.
This GitHub Action is licensed under the Unlicense License. See the LICENSE file for details.