robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

dependabot[bot]ci: bump actions/checkout in the github-actions group across 1 directory20f44076dc

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