repos-mirror-action github action实现不同仓库代码同步
一个用于在hub间(例如Github,Gitee)代码仓库同步的action
背景
在开源贡献的代码托管的过程中,我们有时候有需要将Github的代码同步到其他远端仓库的需求。具体的,对于我们目前参与的项目来说核心诉求是:以Github社区作为主仓,并且定期自动同步到Gitee作为镜像仓库。
github action: https://github.com/marketplace/actions/repo-mirror-sync
实现
- 将其他公共或私有存储库(例如模板存储库)与当前存储库同步
- 支持不同的 git 提供商,如 GitLab、Gittea…作为源(使用 https)。
- 源存储库和目标存储库不一定需要具有相同的基本历史记录。
因此,可以借助该操作合并两个不同的存储库。
用法
模板库
name: <action-name>
on:
- push
- delete
jobs:
sync:
runs-on: ubuntu-latest
name: Repo Mirror Sync
steps:
- uses: actions/checkout@v3
- name: Repo Mirror Sync
uses: kubeservice-stack/repos-mirror-action@<latest version>
with:
# Such as https://github.com/dongjiang1989/mirror-action.git
target-url: <target-url>
# Such as dongjiang1989
target-username: <target-username>
# You can store token in your project's 'Setting > Secrets' and reference the name here. Such as ${{ secrets.ACCESS_TOKEN }}
target-token: <target-token>
配置参数
Variable | Description | Required | [Default] |
---|---|---|---|
target-token | 回购协议的令牌。可以兑换使用${{ secrets.GITHUB_TOKEN } |
true |
|
target-username | 存储库用户名 | true |
|
target-url | https 协议的目标 URL |
true |
其他:代码工程
- https://github.com/marketplace/actions/repo-mirror-sync
- https://github.com/kubeservice-stack/repos-mirror-action
「如果这篇文章对你有用,请随意打赏」
FEATURED TAGS
agent
apiserver
application
bandwidth-limit
cgo
cgroupfs
ci/cd
client-go
cloudnative
cncf
cni
community
container
container-network-interface
containerd
controller
coredns
crd
custom-controller
deployment
docker
docker-build
docker-image
drop
ebpf
ecology
egress
etcd
gitee
github
gitlab
golang
governance
hpa
http2
image
ingress
iptables
jobs
kata
kata-runtime
kernel
kind
kubelet
kubenetes
kubernetes
library
linux-os
logging
loki
metrics
monitor
namespace
network
network-troubleshooting
node
nodeport
pingmesh
pod
prestop
prometheus
proxyless
pvc
rollingupdate
schedule
scheduler
serverless
sidecar
sigtrem
systemd
throttling
timeout
tools
traceroute