-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (112 loc) · 4.75 KB
/
scheduled-update-mirrors.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Scheduled Update Mirrors
# An action to perform a sync of the curated mirrors. A side effect of this
# workflow is to normalize case from the source before pushing it to the
# destination.
# Requires
# secrets.ACTIONS_GITHUB_TOKEN Personal Access Token
# Permissions for Personal Access Token
# - All Repositories
# - Actions: RW
# - Content: RW
# - Metadata: RO
# - Secrets: RO
# - Variables: RO
# - 5 Permissions
on:
# 00:00 CST == 06:00 UTC
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
actions: write
contents: write
defaults:
run:
shell: bash
jobs:
execute:
runs-on: ubuntu-24.04
steps:
- uses: liskin/[email protected]
- name: update-mirrors
run: |
:
echo "::add-mask::https://"
SRC_URI=(
https://git.openembedded.org/bitbake
https://src.libcode.org/pkun/faux.git
https://src.libcode.org/pkun/klish.git
https://git.yoctoproject.org/meta-amd
https://git.yoctoproject.org/meta-arm
https://github.com/kraj/meta-clang.git
https://git.yoctoproject.org/meta-cloud-services
https://git.yoctoproject.org/meta-dpdk
https://github.com/Freescale/meta-freescale.git
https://github.com/Freescale/meta-freescale-3rdparty.git
https://git.yoctoproject.org/meta-intel
https://git.yoctoproject.org/meta-lts-mixins
https://git.yoctoproject.org/git/meta-mingw
https://git.openembedded.org/meta-openembedded
https://git.openembedded.org/meta-openembedded-contrib
https://github.com/meta-qt5/meta-qt5.git
https://code.qt.io/yocto/meta-qt6.git
https://github.com/agherzan/meta-raspberrypi.git
https://github.com/riscv/meta-riscv.git
https://github.com/meta-rust/meta-rust.git
https://github.com/Wind-River/meta-secure-core.git
https://git.yoctoproject.org/meta-security
https://git.yoctoproject.org/meta-selinux
https://github.com/STMicroelectronics/meta-st-stm32mp.git
https://github.com/linux-sunxi/meta-sunxi.git
https://github.com/OE4T/meta-tegra.git
https://git.yoctoproject.org/meta-tensorflow
https://git.yoctoproject.org/meta-ti
https://github.com/uptane/meta-updater.git
https://git.yoctoproject.org/meta-virtualization
https://github.com/foundriesio/meta-xilinx.git
https://github.com/foundriesio/meta-xilinx-tools.git
https://git.yoctoproject.org/meta-yocto
https://github.com/zehome/MLVPN.git
https://git.openembedded.org/openembedded-core
https://git.yoctoproject.org/poky
https://git.yoctoproject.org/poky-contrib
https://github.com/tailscale/tailscale.git
https://github.com/veracrypt/VeraCrypt.git
https://github.com/veracrypt/VeraCrypt-DCS.git
https://github.com/KDE/yocto-meta-kde.git
https://github.com/KDE/yocto-meta-kf5.git
https://github.com/KDE/yocto-meta-kf6.git
)
:
errors=0
for src_uri in ${SRC_URI[*]}; do
src_name=$(basename $src_uri .git | tr '[:upper:]' '[:lower:]')
dst_uri="https://x-access-token:${{ secrets.ACTIONS_GITHUB_TOKEN }}@github.com/distro-core-curated-mirrors/$src_name.git"
rm -fr $src_name
if git clone --mirror $src_uri $src_name >git-clone.log; then
echo "Success git clone $src_uri"
cd $src_name
git for-each-ref --format "delete %(refname)" refs/pull | git update-ref --stdin
git for-each-ref --format "delete %(refname)" refs/meta | git update-ref --stdin
git for-each-ref --format "delete %(refname)" refs/merge-requests | git update-ref --stdin
git for-each-ref --format "delete %(refname)" refs/reviewable | git update-ref --stdin
git for-each-ref --format "delete %(refname)" 'refs/tags/cicd*' | git update-ref --stdin
if git push --porcelain --mirror $dst_uri >../git-push.log; then
echo "Success git push $dst_uri"
grep -v "\[up to date\]" ../git-push.log
else
errors=$(( errors + 1 ))
echo "::warning::failure git push $dst_uri"
fi
cd ..
else
errors=$(( errors + 1 ))
echo "::warning::failure git clone $src_uri"
fi
rm -fr $src_name
done
if [[ $errors -gt 0 ]]; then
echo "::error::completed with failures"
exit 1
fi
echo "::notice::completed"