Skip to content

cssnr/mirror-repository-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Tag Major GitHub Tag Minor GitHub Release Version Workflow Release Workflow Test Workflow Lint Quality Gate Status GitHub Last Commit Codeberg Last Commit GitHub Contributors GitHub Repo Size GitHub Top Language GitHub Discussions GitHub Forks GitHub Repo Stars GitHub Org Stars Discord Ko-fi

Mirror Repository Action

Mirror Git Repository to Remote Host.

Tip

Check out the Getting Started guide online.

Inputs

Input Name Default Value Short Description of the Input Value
url or host Full URL to Mirror; Overrides: host/owner/repo
host or url Full Host to Mirror; Example: https://codeberg.org
owner Repo Owner Repository Owner of Mirror (if different from source)
repo Repo Name Repository Name of Mirror (if different from source)
create false Set to true to attempt to Create the Mirror Repo
username Repo Owner Username for Authentication to Mirror
password Required Token or Password for Authentication to Mirror
summary true Add Job Summary. Set to false to Disable
private Repo Private If the Mirror Repo Status is Different from Source

url/host

You must provide either a full repository url or a host value.
Example: https://github.com/cssnr/mirror-repository-action

owner/repo

If different from source, you must specify these values (overridden by url).

create

Tested with Codeberg but should also work with Gitea/Forgejo. Set to true to enable.

username

Authentication username if different from owner.

password

Authentication password or token associated with the username.

summary

Write a Summary for the job. To disable this set to false.

👀 View Example Job Summary

✅ Successfully Mirrored: cssnr/mirror-repository-action

Results
remote:
remote: Create a new pull request for 'updates':
remote:   https://codeberg.org/cssnr/mirror-repository-action/compare/master...updates
remote:
To https://codeberg.org/cssnr/mirror-repository-action
   eaadc3f..da84f34  origin/updates -> updates

private

If the Mirror Repo Status is Different from Source.

Setup Instructions

  1. Create a Token for Mirror to use as a Password for Pushing Commits, or Creating Repositories.

  2. Create Remote Repository to Mirror (or set create to true for codeberg.org).

  3. Go to the settings for your source repository on GitHub and add the CODEBERG_TOKEN secret.

    • For organizations, you can add the token one time at the Organization level.
  4. Add the following file to source repository on GitHub: .github/workflows/mirror.yaml

    • The owner is automatically set to the GitHub Organization or Username if personal. Set to override.
    • The repo is automatically set to the GitHub Repository Name. This should only be set to rename repo.
    • For Codeberg, use the host to https://codeberg.org and set the username to your Codeberg username.

Tip

This process has been automated with a Web Extension.
However, currently requires manual installation: cssnr/github-extension

Example

The below yaml is available in this file: .github/workflows/mirror.yaml

name: 'Mirror'

on:
  workflow_dispatch:
  push:
    branches: ['**']
    tags: ['**']

jobs:
  mirror:
    name: 'Mirror'
    runs-on: ubuntu-latest
    timeout-minutes: 5

    steps:
      - name: 'Checkout'
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: 'Mirror to Codeberg'
        uses: cssnr/mirror-repository-action@v1
        with:
          #url: https://codeberg.org/cssnr/mirror-repository-action
          host: https://codeberg.org
          #owner: cssnr
          #repo: mirror-repository-action
          create: true
          username: shaner
          password: ${{ secrets.CODEBERG_TOKEN }}

Important

Checkout with: fetch-depth: 0 is necessary!

For more examples, you can check out other projects using this action:
https://github.com/cssnr/mirror-repository-action/network/dependents

Tags

The following rolling tags are maintained.

Version Tag Rolling Bugs Feat. Name Target Example
GitHub Tag Major Major vN.x.x vN
GitHub Tag Minor Minor vN.N.x vN.N
GitHub Release Micro vN.N.N vN.N.N

You can view the release notes for each version on the releases page.

The Major tag is recommended. It is the most up-to-date and always backwards compatible. Breaking changes would result in a Major version bump. At a minimum you should use a Minor tag.

Support

For general help or to request a feature, see:

If you are experiencing an issue/bug or getting unexpected results, you can:

For more information, see the CSSNR SUPPORT.md.

Contributing

If you would like to submit a PR, please review the CONTRIBUTING.md.

Please consider making a donation to support the development of this project and additional open source projects.

Ko-fi

Additionally, you can support other GitHub Actions I have published:

❔ Unpublished Actions

These actions are not published on the Marketplace, but may be useful.


📝 Template Actions

These are basic action templates that I use for creating new actions.

Note: The docker-test-action builds, runs and pushes images to GitHub Container Registry.


For a full list of current projects to support visit: https://cssnr.github.io/

About

Mirror Git Repository to Remote Host

Topics

Resources

Contributing

Stars

Watchers

Forks

Sponsor this project