sync remote patches #2
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: '0 0 1 * *' # “Once a month.” | |
| 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 TKT | |
| uses: actions/checkout@v4 | |
| - name: Sync patches | |
| id: update-patches | |
| run: | | |
| set -e | |
| cd kpatches | |
| 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 kpatches/$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 'ETJAKEOC' | |
| git config --global user.email 'ETJAKEOC@gmail.com' | |
| cd kpatches | |
| git add . | |
| git commit -m "Update ${{ matrix.description }}" | |
| git pull --rebase | |
| git push |