vim_patches.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: vim-patches
  2. on:
  3. schedule:
  4. - cron: '3 3 * * *'
  5. workflow_dispatch:
  6. jobs:
  7. update-vim-patches:
  8. runs-on: ubuntu-latest
  9. permissions:
  10. contents: write
  11. pull-requests: write
  12. env:
  13. VIM_SOURCE_DIR: ${{ github.workspace }}/vim-src
  14. VERSION_BRANCH: marvim/ci-version-update
  15. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  16. steps:
  17. - uses: actions/checkout@v4
  18. with:
  19. fetch-depth: 0
  20. - uses: actions/checkout@v4
  21. with:
  22. repository: vim/vim
  23. path: ${{ env.VIM_SOURCE_DIR }}
  24. fetch-depth: 0
  25. - run: sudo apt-get install libfuse2
  26. - run: |
  27. gh release download -R neovim/neovim -p nvim.appimage
  28. chmod a+x nvim.appimage
  29. mkdir -p $HOME/.local/bin
  30. mv nvim.appimage $HOME/.local/bin/nvim
  31. printf '%s\n' "$HOME/.local/bin" >> $GITHUB_PATH
  32. - name: Set up git config
  33. run: |
  34. git config --global user.name 'marvim'
  35. git config --global user.email 'marvim@users.noreply.github.com'
  36. - name: Update src/version.c
  37. id: update-version
  38. run: |
  39. git checkout -b ${VERSION_BRANCH}
  40. nvim -V1 -es -i NONE +'luafile scripts/vimpatch.lua' +q
  41. printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT
  42. - name: Automatic PR
  43. if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }}
  44. run: |
  45. git add -u
  46. git commit -m 'docs: update version.c'
  47. git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH}
  48. gh pr create --draft --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true