Mirror Git Repository to Remote Host.
input | required | default | description |
---|---|---|---|
url | Not w/ host |
- | * Full URL to Mirror, overrides: host /owner /repo |
host | Not w/ url |
- | * Full Host to Mirror, example: https://codeberg.org |
owner | No | Repo Owner | * Repository Owner of Mirror (if different from source) |
repo | No | Repo Name | * Repository Name of Mirror (if different from source) |
create | No | - | * Set to true to attempt to Create the Mirror Repo |
username | No | Repo Owner | Username for Authentication to Mirror |
password | Yes | - | Token or Password for Authentication to Mirror |
url/host - You must provide either a full repository url
or a host
value.
owner/repo - If different from source, you must specify these values.
create - Tested with codeberg but should also work with gitea/forgejo. Do not set or leave empty to disable.
-
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:organization
write:repository
write:user
-
Create Remote Repository to Mirror, or set
create
totrue
, for example:https://codeberg.org
-
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.
-
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
below and set theusername
to your Codeberg username.
- The
The below yaml is available in this file: .github/workflows/mirror.yaml
name: 'Mirror'
on:
workflow_dispatch:
release:
types: ['published']
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@master
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 general help or to request a feature, see:
- Q&A Discussion: https://github.com/cssnr/mirror-repository-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/mirror-repository-action/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results, you can:
- Report an Issue: https://github.com/cssnr/mirror-repository-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: https://cssnr.github.io/feedback/
Currently, the best way to contribute to this project is to star this project on GitHub.
Additionally, you can support other GitHub Actions I have published:
- VirusTotal Action
- Update Version Tags Action
- Update JSON Value Action
- Parse Issue Form Action
- Mirror Repository Action
- Portainer Stack Deploy
- Mozilla Addon Update Action
For a full list of current projects to support visit: https://cssnr.github.io/
- Install
act
: https://nektosact.com/installation/index.html - List Workflows:
act -l
- Run a Workflow:
act -j test
If you need files from .gitignore use: --use-gitignore=false
For advanced using with things like secrets, variables and context see: https://nektosact.com/usage/index.html
You should also review the options from act --help
Note, the .env
, .secrets
and .vars
files are automatically sourced with no extra options.
To source event.json
you need to run act with act -e event.json