sync remote patches #100
This file contains hidden or 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: sync remote patches | |
| on: | |
| schedule: | |
| - cron: '17 */12 * * *' # “At minute 17 past every 12th hour.” | |
| workflow_dispatch: | |
| jobs: | |
| sync-remote-patch: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 1 | |
| matrix: | |
| include: | |
| - description: Project C patch from CachyOS repo | |
| src_file_link: https://github.com/CachyOS/kernel-patches/raw/refs/heads/master/$kver/sched/0001-prjc.patch | |
| copy_as: 0009-prjc.patch | |
| - description: BORE patch from CachyOS repo | |
| src_file_link: https://github.com/CachyOS/kernel-patches/raw/refs/heads/master/$kver/sched/0001-bore.patch | |
| copy_as: 0001-bore.patch | |
| - description: Gentoo Kconfig patch | |
| src_file_link: https://dev.gentoo.org/~mpagano/genpatches/trunk/$kver/4567_distro-Gentoo-Kconfig.patch | |
| copy_as: 0013-gentoo-kconfig.patch | |
| - description: Gentoo Print loaded firmware patch | |
| src_file_link: https://dev.gentoo.org/~mpagano/genpatches/trunk/$kver/3000_Support-printing-firmware-info.patch | |
| copy_as: 0013-gentoo-print-loaded-firmware.patch | |
| steps: | |
| - name: Checkout linux-tkg | |
| uses: actions/checkout@v4 | |
| - name: Sync patches | |
| id: update-patches | |
| run: | | |
| set -e | |
| cd linux-tkg-patches | |
| for kver in * | |
| do | |
| [[ ! -d "$kver" ]] && continue | |
| file_link=$(eval "echo ${{ matrix.src_file_link }}") | |
| echo "Checking link $file_link" | |
| if wget $file_link -O $kver/"${{ matrix.copy_as }}".new &> /dev/null | |
| then | |
| echo "Link exists" | |
| echo "Overwriting linux-tkg-patches/$kver/${{ matrix.copy_as }} with remote file" | |
| mv -f $kver/"${{ matrix.copy_as }}".new $kver/"${{ matrix.copy_as }}" | |
| git add -N $kver/"${{ matrix.copy_as }}" | |
| else | |
| echo "Link doesn't exist" | |
| rm $kver/"${{ matrix.copy_as }}".new | |
| fi | |
| done | |
| if git diff --exit-code . > /dev/null | |
| then | |
| echo "patches-updated=0" >> $GITHUB_OUTPUT | |
| else | |
| echo "patches-updated=1" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Push changes | |
| if: steps.update-patches.outputs.patches-updated == '1' | |
| run: | | |
| git config --global user.name 'Frogminer' | |
| git config --global user.email 'frogminer@miner.frog' | |
| cd linux-tkg-patches | |
| git add . | |
| git commit -m "Update ${{ matrix.description }}" | |
| git pull --rebase | |
| git push |