Skip to content

Commit 257605b

Browse files
committed
Initial commit
0 parents  commit 257605b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/mirror.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update mirrors
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 * * * *'
7+
8+
jobs:
9+
update-mirror:
10+
name: Update mirror
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
source:
17+
- https://chromium.googlesource.com/chromium/src/build
18+
- https://chromium.googlesource.com/chromium/src/buildtools
19+
- https://chromium.googlesource.com/chromium/src/testing
20+
- https://chromium.googlesource.com/chromium/src/third_party/jsoncpp
21+
- https://chromium.googlesource.com/chromium/src/third_party/zlib
22+
23+
steps:
24+
- uses: actions/checkout@v5
25+
with:
26+
submodules: recursive
27+
- name: Get repo name
28+
id: info
29+
run: |
30+
repo=$(printf '%s\n' '${{ matrix.source }}' | cut -d/ -f4- | tr / -)
31+
printf 'repo=%s\n' "$repo" >> $GITHUB_OUTPUT
32+
- name: Get SSH key
33+
id: key
34+
run: |
35+
printf 'name=%s_SSH_KEY\n' "$(
36+
printf '%s\n' '${{ steps.info.outputs.repo }}' |
37+
tr '[:lower:]-' '[:upper:]_'
38+
)" >> "$GITHUB_OUTPUT"
39+
- uses: actions/checkout@v5
40+
with:
41+
repository: gsource-mirror/${{ steps.info.outputs.repo }}
42+
path: ${{ steps.info.outputs.repo }}
43+
ssh-key: ${{ secrets[steps.key.outputs.name] }}
44+
- name: Update ${{ steps.info.outputs.repo }} repo
45+
run: |
46+
cd '${{ steps.info.outputs.repo }}'
47+
push_url=$(git remote get-url origin)
48+
git remote remove origin
49+
git remote add origin --mirror=fetch '${{ matrix.source }}'
50+
git fetch -p origin
51+
git push --mirror "$push_url"

0 commit comments

Comments
 (0)