copy-commit-to-another-repo
is a GitHub Action that copies commits from the current repository to another repository.
The intent is to enable keeping two isolated repositories in sync; e.g., you have work
and home
repositories for your dotfiles, and you want to be able to update either, keeping shared files in sync, including commit messages, while not syncing everything.
PERSONAL_ACCESS_TOKEN
- this needs to be set underSettings
->Secrets and variables
->Actions
->New repository secret
on the source repository. Create a token underSettings
->Developer settings
->Personal access tokens
->Tokens (classic)
orFine-grained tokens
. The token will needrepo
permissions (classic) orRepository permissions
->Contents
permissions (fine-grained).
destination
- the repository to copy commits to.branch
[optional] - the branch to copy commits to. If unspecified, the default branch fordestination
will be used.include
[optional] - a comma-separated list of regular expressions to match against; e.g.,hello,world?
. If specified, only changes to files that match a pattern ininclude
will be copied. Bothinclude
andexclude
may be specified. If neitherinclude
norexclude
are specified, all changes will be copied.exclude
[optional] - a comma-separated list of regular expressions to match against; e.g.,hello,world?
. If specified, all changes will be copied except changes to files that match a pattern inexclude
. Bothinclude
andexclude
may be specified. If neitherinclude
norexclude
are specified, all changes will be copied.
name: Copy Commit
on: push
jobs:
copy-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Copy Commit
uses: jeffreyc/copy-commit-to-another-repo@v1.0.0
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
include: 'hello,world?'
exclude: '"world,"'
destination: 'jeffreyc/hello-copy'
branch: 'staging'
n.b., you must specify fetch-depth: 2
for the Checkout
action, else git will be unable to determine what has changed.
copy-commit-to-another-repo
is released under the BSD 3-Clause License.