Skip to content

Commit eca091a

Browse files
committed
ci(gh): Automatically create PR for version.c updates
[skip ci]
1 parent 0f7b6b2 commit eca091a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/nightly.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Nightly
2+
on:
3+
schedule:
4+
- cron: '3 3 * * *'
5+
6+
jobs:
7+
update-vim-patches:
8+
runs-on: ubuntu-20.04
9+
env:
10+
VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }}
11+
VERSION_BRANCH: marvim/ci-version-update
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/checkout@v2
19+
with:
20+
repository: vim/vim
21+
path: ${{ env.VIM_SOURCE_DIR }}
22+
fetch-depth: 0
23+
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+
31+
- name: Setup git config
32+
run: |
33+
git config --global user.name 'marvim'
34+
git config --global user.email '[email protected]'
35+
36+
- name: Update src/version.c
37+
id: update-version
38+
run: |
39+
git checkout -b ${VERSION_BRANCH}
40+
nvim -i NONE -u NONE --headless +'luafile scripts/vimpatch.lua' +q
41+
printf '::set-output name=NEW_PATCHES::%s\n' $([ -z "$(git diff)" ]; echo $?)
42+
43+
- name: Automatic PR
44+
if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }}
45+
run: |
46+
git add -u
47+
git commit -m 'version.c: update [skip ci]'
48+
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH}
49+
gh pr create --fill --label vim-patch --base master --head ${VERSION_BRANCH} || true

0 commit comments

Comments
 (0)