Use github-mirror-action@v3 #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
matrix: ${{ steps.check.outputs.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="workflows.json" | |
cd $REPO | |
for branch in $( cat rc-branches ); do | |
git worktree add ../${branch} ${branch} | |
pushd ../${branch} | |
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 ",{\"workflow\":\"build_${branch}.yml\"}" >> ../${JSON_DATA_FILE} | |
else | |
echo -n "{\"workflow\":\"build_${branch}.yml\"}" >> ../${JSON_DATA_FILE} | |
fi | |
fi | |
popd | |
done | |
echo "::set-output name=matrix::{\"include\":[$( cat ../${JSON_DATA_FILE} )]}" | |
signal_build: | |
needs: mirror_and_check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{fromJson(needs.mirror_and_check.outputs.matrix)}} | |
steps: | |
- name: test | |
run: | | |
echo ${{ matrix.workflow }} | |
# uses: ./.github/workflows/${{ matrix.workflow }} |