GithubHelp home page GithubHelp logo

github-mirror-action's Introduction

GitHub Mirror

Github Mirror is a GitHub Action that keeps a GitHub repository up to date as a mirror of an external repository. It will synchronize all branches and commits from the specified repository; it will not copy non-Git data such as Pull Requests.

Create from Template

If you'd prefer to use the GitHub UI instead of the CLI, you can use the template repository.

Steps:

  1. Click Use this template.
  2. Name your repository
  3. Edit .github/workflows/mirror.yml and enter the URL you wish to mirror where it says origin: ''
  4. Commit your change

Manual Setup

To create a mirror, start by creating a repository locally and creating a branch to hold the workflow file. The branch should be named such that it will not conflict with a branch name in the source repository.

$ gh repo create --public --confirm mirror
$ git -C mirror checkout -b __mirror
$ mkdir -p mirror/.github/workflows

Create a file like the one below in your repository. Replace TARGET_REPO_HERE with the URL of a the git repository to mirror.

# .github/workflows/mirror.yml
name: 'mirror'
on:
  push:
    branches:
        - __mirror
  schedule:
    - cron: '* 3 * * *'
  workflow_dispatch:

jobs:
  mirror:
    runs-on: ubuntu-latest
    name: mirror
    steps:
      - name: mirror
        id: mirror
        uses: bridgelightcloud/github-mirror-action@v1
        with:
          origin: 'TARGET_REPO_HERE'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Commit and push your changes

$ git -C mirror add .
$ git -C mirror commit -am 'Add mirror workflow'
$ git -C mirror push -u origin __mirror

The workflow will start immediately and copy the source repository. The workflow will continue to run on the schedule specified on the cron line (in the example above, 3 AM UTC every day). You can also run the workflow manually by selecting it in the Actions tab on GitHub.

License

The code is trivial, as such this repository is licensed under the Creative Commons CC-0 license.

github-mirror-action's People

Contributors

amadigan avatar kaidokert avatar seannyphoenix avatar

Stargazers

 avatar  avatar  avatar  avatar Gabben avatar Nicholas Buchele avatar ketal avatar  avatar Graham White avatar Zhenyu Zhu ajz34 avatar

Watchers

 avatar James Cloos avatar  avatar

github-mirror-action's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.