Mirror Repository Action
Mirror Git Repository to Remote Host. Supports automatic repository detection, partial and full overrides, authentication, auto-create destination, and much more.
To get started, create or update your workflow file.
Workflow
Add the step to an existing workflow or create a new one.
- 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 }}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@v5
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 }}Hash Copied to Clipboard
Check out the Rolling Tags for more tag options.
See the Setup Instructions below for more details.
See the Inputs Documentation for additional options and default values.
Features
- Automatic repository detection.
- Individually override owner/repo/host.
- Optionally set owner/repo/host as a string.
- Allows authentication with username and password.
- Option to automatically create destination repository.
Don't see your feature here? Please help by submitting a Feature Request.
Rolling Tags
The following rolling tags are maintained to improve stability across updates.
| Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | Major | vN.x.x | vN | |
| ✅ | ✅ | ❌ | Minor | vN.N.x | vN.N | |
| ❌ | ❌ | ❌ | 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.
Tags Security Notice
As shown above, tags are mutable; however, commit hashes are not. Therefore, if security is your top priority, you should pin your actions to a specific commit hash.
Setup Instructions
Create a Token for Mirror to use as a Password for Pushing Commits, or Creating Repositories.
- Codeberg/Gitea/Forgejo go here: https://codeberg.org/user/settings/applications
- Select Permissions:
write:organizationwrite:repositorywrite:user
Create Remote Repository to Mirror (or set
createtotruefor codeberg.org).Go to the settings for your source repository on GitHub and add the
CODEBERG_TOKENsecret.- For organizations, you can add the token one time at the Organization level.
Add the following file to source repository on GitHub:
.github/workflows/mirror.yaml- The
owneris automatically set to the GitHub Organization or Username if personal. Set to override. - The
repois automatically set to the GitHub Repository Name. This should only be set to rename repo. - For Codeberg, use the
hosttohttps://codeberg.organd set theusernameto your Codeberg username.
- The
See the Inputs Documentation for additional options and default values.
WARNING
These docs are not finished. Please see the README.md on GitHub.
