-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (71 loc) · 2.28 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: 'mirror'
on:
push:
branches:
- __mirror
schedule:
# Run everyday at 3 AM UTC
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
mirror_and_check:
runs-on: ubuntu-latest
outputs:
branch_matrix: ${{ steps.check.outputs.branch_matrix }}
steps:
- name: mirror
id: mirror
uses: bridgelightcloud/github-mirror-action@v3
with:
origin: 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git'
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: check
id: check
run: |
REPO=$( basename $PWD )
cd ..
mv $REPO ${REPO}.git
git clone --shared ${REPO}.git $REPO
JSON_DATA_FILE="$PWD/workflows.json"
cd $REPO
pwd
for branch in $( cat rc-branches ); do
git worktree add ../${branch} ${branch}
pushd ../${branch}
pwd
if git log --oneline HEAD~1 | head -n1 | grep "Linux\ .*\-rc.*" >/dev/null; then
KERNEL_VERSION=$( git log --oneline HEAD~1 | head -n1 | grep -o "Linux\ .*\-rc.*" )
echo "build ${KERNEL_VERSION}"
if [[ -e ${JSON_DATA_FILE} ]]; then
echo -n ", \"build_${branch}.yml\"" >> ${JSON_DATA_FILE}
else
echo -n "[\"build_${branch}.yml\"" >> ${JSON_DATA_FILE}
fi
fi
cat ${JSON_DATA_FILE}
popd
pwd
done
echo -n "]" >> ${JSON_DATA_FILE}
pwd
ls -1
ls -1 ../
cat -v ${JSON_DATA_FILE}
JSON_DATA=$( cat ${JSON_DATA_FILE} )
cat > JSON <<EOF
{
"workflow": ["build_linux-6.6.y.yml", "build_linux-6.1.y.yml", "test123"]
}
EOF
echo "branch_matrix=$( cat JSON )" >> $GITHUB_OUTPUT
# echo "branch_matrix=$( jq -cn --argjson environments "$JSON_DATA" '{workflow: $environments}' )" >> $GITHUB_OUTPUT
signal_build:
needs: mirror_and_check
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.mirror_and_check.outputs.branch_matrix)}}
steps:
- name: test
run: |
echo ${{ matrix.workflow }}
# uses: ./.github/workflows/${{ matrix.workflow }}