-
Notifications
You must be signed in to change notification settings - Fork 119
53 lines (42 loc) · 1.38 KB
/
gitlab-mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: gitlab-mirror
on:
schedule:
# Runs every hour, on the hour
- cron: '0 * * * *'
# To be able to manually trigger the job from GitHub UI
workflow_dispatch:
permissions:
# Necessary to be able to push to the repo
contents: write
jobs:
mirror:
name: gitlab-mirror
concurrency: mirror # Only 1 mirror job needs to run at once
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Checks out the github repo, but crucially also sets up git auth.
repository: ${{ github.repository }}
path: target-repo
ref: main
- name: Push Mirror git
# This force pushes to main! Be sure you want to run this!
run: |
set -x
cd target-repo || exit 1
git remote add gitlab https://git.gitlab.arm.com/tooling/lisa.git
function mirror() {
local ref=$1
git fetch gitlab "$ref" &&
git push -f origin "FETCH_HEAD:$ref"
}
mirror refs/heads/main
mirror refs/heads/release
# This is used as the source of commits to add on top of main to
# build the master branch content
mirror refs/heads/for-master
mirror refs/heads/master-force
mirror refs/heads/master
mirror refs/heads/preview-force
mirror refs/heads/preview