vim-patches.yml 1.7 KB

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