From 3047a909a2cdd023713e30e0628415e08afb66e1 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 26 Apr 2021 23:29:10 -0400 Subject: ci(gha/nightly): Enable "contents: write" permissions to setup PR [skip ci] --- .github/workflows/nightly.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 431ccd8b61..5823d8187e 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -6,6 +6,9 @@ on: jobs: update-vim-patches: runs-on: ubuntu-20.04 + permissions: + contents: write + pull-requests: write env: VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }} VERSION_BRANCH: marvim/ci-version-update -- cgit From 2601296c3f871cc49d10b2d96ce0bf7a9de4ee1b Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 26 Apr 2021 23:38:36 -0400 Subject: ci(gha): Rename nightly workflow to vim-patches [skip ci] --- .github/workflows/nightly.yaml | 52 --------------------------------------- .github/workflows/vim-patches.yml | 52 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/nightly.yaml create mode 100644 .github/workflows/vim-patches.yml diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml deleted file mode 100644 index 5823d8187e..0000000000 --- a/.github/workflows/nightly.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Nightly -on: - schedule: - - cron: '3 3 * * *' - -jobs: - update-vim-patches: - runs-on: ubuntu-20.04 - permissions: - contents: write - pull-requests: write - env: - VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }} - VERSION_BRANCH: marvim/ci-version-update - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: actions/checkout@v2 - with: - repository: vim/vim - path: ${{ env.VIM_SOURCE_DIR }} - fetch-depth: 0 - - - run: | - gh release download -R neovim/neovim -p nvim.appimage - chmod a+x nvim.appimage - mkdir -p $HOME/.local/bin - mv nvim.appimage $HOME/.local/bin/nvim - printf '%s\n' "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Setup git config - run: | - git config --global user.name 'marvim' - git config --global user.email 'marvim@users.noreply.github.com' - - - name: Update src/version.c - id: update-version - run: | - git checkout -b ${VERSION_BRANCH} - nvim -i NONE -u NONE --headless +'luafile scripts/vimpatch.lua' +q - printf '::set-output name=NEW_PATCHES::%s\n' $([ -z "$(git diff)" ]; echo $?) - - - name: Automatic PR - if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }} - run: | - git add -u - git commit -m 'version.c: update [skip ci]' - git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH} - gh pr create --fill --label vim-patch --base master --head ${VERSION_BRANCH} || true diff --git a/.github/workflows/vim-patches.yml b/.github/workflows/vim-patches.yml new file mode 100644 index 0000000000..38e19d5e25 --- /dev/null +++ b/.github/workflows/vim-patches.yml @@ -0,0 +1,52 @@ +name: vim-patches +on: + schedule: + - cron: '3 3 * * *' + +jobs: + update-vim-patches: + runs-on: ubuntu-20.04 + permissions: + contents: write + pull-requests: write + env: + VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }} + VERSION_BRANCH: marvim/ci-version-update + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/checkout@v2 + with: + repository: vim/vim + path: ${{ env.VIM_SOURCE_DIR }} + fetch-depth: 0 + + - run: | + gh release download -R neovim/neovim -p nvim.appimage + chmod a+x nvim.appimage + mkdir -p $HOME/.local/bin + mv nvim.appimage $HOME/.local/bin/nvim + printf '%s\n' "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Setup git config + run: | + git config --global user.name 'marvim' + git config --global user.email 'marvim@users.noreply.github.com' + + - name: Update src/version.c + id: update-version + run: | + git checkout -b ${VERSION_BRANCH} + nvim -i NONE -u NONE --headless +'luafile scripts/vimpatch.lua' +q + printf '::set-output name=NEW_PATCHES::%s\n' $([ -z "$(git diff)" ]; echo $?) + + - name: Automatic PR + if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }} + run: | + git add -u + git commit -m 'version.c: update [skip ci]' + git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH} + gh pr create --fill --label vim-patch --base master --head ${VERSION_BRANCH} || true -- cgit From 0ab1f9ff3fb2036e9ef51672193620aff704884e Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 26 Apr 2021 23:41:25 -0400 Subject: ci(gha/vim-patches): Create PR against branch running the workflow Avoids hard-coding branch names. [skip ci] --- .github/workflows/vim-patches.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vim-patches.yml b/.github/workflows/vim-patches.yml index 38e19d5e25..5742b51158 100644 --- a/.github/workflows/vim-patches.yml +++ b/.github/workflows/vim-patches.yml @@ -49,4 +49,4 @@ jobs: git add -u git commit -m 'version.c: update [skip ci]' git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH} - gh pr create --fill --label vim-patch --base master --head ${VERSION_BRANCH} || true + gh pr create --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true -- cgit