From dd81e1e3345b91c4cb4653b697c1054526f6b924 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 21:40:24 +0100 Subject: ci: refactor CI files Mostly rename file and variable names to be more consistent. This makes it easier to locate them in the "Actions" tab on github. --- .github/scripts/remove-reviewers.js | 16 ----- .github/scripts/reviewers_add.js | 118 +++++++++++++++++++++++++++++++++ .github/scripts/reviewers_remove.js | 16 +++++ .github/scripts/reviews.js | 118 --------------------------------- .github/workflows/add-reviewers.yml | 19 ------ .github/workflows/api-docs.yml | 34 ---------- .github/workflows/backport.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/coverity.yml | 2 +- .github/workflows/docs.yml | 32 +++++++++ .github/workflows/issue-open-check.yml | 34 ---------- .github/workflows/labeler.yml | 40 ----------- .github/workflows/labeler_issue.yml | 31 +++++++++ .github/workflows/labeler_pr.yml | 40 +++++++++++ .github/workflows/lintcommit.yml | 2 +- .github/workflows/news.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/remove-reviewers.yml | 17 ----- .github/workflows/reviewers_add.yml | 19 ++++++ .github/workflows/reviewers_remove.yml | 17 +++++ .github/workflows/test.yml | 4 +- .github/workflows/vim-patches.yml | 55 --------------- .github/workflows/vim_patches.yml | 55 +++++++++++++++ 23 files changed, 336 insertions(+), 341 deletions(-) delete mode 100644 .github/scripts/remove-reviewers.js create mode 100644 .github/scripts/reviewers_add.js create mode 100644 .github/scripts/reviewers_remove.js delete mode 100644 .github/scripts/reviews.js delete mode 100644 .github/workflows/add-reviewers.yml delete mode 100644 .github/workflows/api-docs.yml create mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/issue-open-check.yml delete mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/labeler_issue.yml create mode 100644 .github/workflows/labeler_pr.yml delete mode 100644 .github/workflows/remove-reviewers.yml create mode 100644 .github/workflows/reviewers_add.yml create mode 100644 .github/workflows/reviewers_remove.yml delete mode 100644 .github/workflows/vim-patches.yml create mode 100644 .github/workflows/vim_patches.yml diff --git a/.github/scripts/remove-reviewers.js b/.github/scripts/remove-reviewers.js deleted file mode 100644 index 9e44e4ac86..0000000000 --- a/.github/scripts/remove-reviewers.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = async ({ github, context }) => { - const requestedReviewers = await github.rest.pulls.listRequestedReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - }); - - const reviewers = requestedReviewers.data.users.map((e) => e.login); - - github.rest.pulls.removeRequestedReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - reviewers: reviewers, - }); -}; diff --git a/.github/scripts/reviewers_add.js b/.github/scripts/reviewers_add.js new file mode 100644 index 0000000000..d28d91c2f6 --- /dev/null +++ b/.github/scripts/reviewers_add.js @@ -0,0 +1,118 @@ +module.exports = async ({ github, context }) => { + const pr_data = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + }); + const labels = pr_data.data.labels.map((e) => e.name); + const reviewers = new Set(); + + if (labels.includes("api")) { + reviewers.add("bfredl"); + reviewers.add("famiu"); + } + + if (labels.includes("build")) { + reviewers.add("dundargoc"); + reviewers.add("jamessan"); + reviewers.add("justinmk"); + } + + if (labels.includes("ci")) { + reviewers.add("dundargoc"); + reviewers.add("jamessan"); + reviewers.add("justinmk"); + } + + if (labels.includes("column")) { + reviewers.add("lewis6991"); + } + + if (labels.includes("dependencies")) { + reviewers.add("jamessan"); + } + + if (labels.includes("diagnostic")) { + reviewers.add("gpanders"); + } + + if (labels.includes("diff")) { + reviewers.add("lewis6991"); + } + + if (labels.includes("distribution")) { + reviewers.add("jamessan"); + } + + if (labels.includes("documentation")) { + reviewers.add("clason"); + } + + if (labels.includes("extmarks")) { + reviewers.add("bfredl"); + } + + if (labels.includes("filetype")) { + reviewers.add("clason"); + reviewers.add("gpanders"); + reviewers.add("smjonas"); + } + + if (labels.includes("lsp")) { + reviewers.add("folke"); + reviewers.add("MariaSolOs"); + reviewers.add("mfussenegger"); + } + + if (labels.includes("options")) { + reviewers.add("famiu"); + } + + if (labels.includes("platform:nix")) { + reviewers.add("teto"); + } + + if (labels.includes("project-management")) { + reviewers.add("bfredl"); + reviewers.add("justinmk"); + } + + if (labels.includes("statusline")) { + reviewers.add("famiu"); + } + + if (labels.includes("test")) { + reviewers.add("justinmk"); + } + + if (labels.includes("treesitter")) { + reviewers.add("bfredl"); + reviewers.add("clason"); + reviewers.add("lewis6991"); + } + + if (labels.includes("typo")) { + reviewers.add("dundargoc"); + } + + if (labels.includes("ui")) { + reviewers.add("bfredl"); + reviewers.add("famiu"); + } + + if (labels.includes("vim-patch")) { + reviewers.add("seandewar"); + reviewers.add("zeertzjq"); + } + + // Remove person that opened the PR since they can't review themselves + const pr_opener = pr_data.data.user.login; + reviewers.delete(pr_opener); + + github.rest.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + reviewers: Array.from(reviewers), + }); +}; diff --git a/.github/scripts/reviewers_remove.js b/.github/scripts/reviewers_remove.js new file mode 100644 index 0000000000..9e44e4ac86 --- /dev/null +++ b/.github/scripts/reviewers_remove.js @@ -0,0 +1,16 @@ +module.exports = async ({ github, context }) => { + const requestedReviewers = await github.rest.pulls.listRequestedReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + }); + + const reviewers = requestedReviewers.data.users.map((e) => e.login); + + github.rest.pulls.removeRequestedReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + reviewers: reviewers, + }); +}; diff --git a/.github/scripts/reviews.js b/.github/scripts/reviews.js deleted file mode 100644 index d28d91c2f6..0000000000 --- a/.github/scripts/reviews.js +++ /dev/null @@ -1,118 +0,0 @@ -module.exports = async ({ github, context }) => { - const pr_data = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - }); - const labels = pr_data.data.labels.map((e) => e.name); - const reviewers = new Set(); - - if (labels.includes("api")) { - reviewers.add("bfredl"); - reviewers.add("famiu"); - } - - if (labels.includes("build")) { - reviewers.add("dundargoc"); - reviewers.add("jamessan"); - reviewers.add("justinmk"); - } - - if (labels.includes("ci")) { - reviewers.add("dundargoc"); - reviewers.add("jamessan"); - reviewers.add("justinmk"); - } - - if (labels.includes("column")) { - reviewers.add("lewis6991"); - } - - if (labels.includes("dependencies")) { - reviewers.add("jamessan"); - } - - if (labels.includes("diagnostic")) { - reviewers.add("gpanders"); - } - - if (labels.includes("diff")) { - reviewers.add("lewis6991"); - } - - if (labels.includes("distribution")) { - reviewers.add("jamessan"); - } - - if (labels.includes("documentation")) { - reviewers.add("clason"); - } - - if (labels.includes("extmarks")) { - reviewers.add("bfredl"); - } - - if (labels.includes("filetype")) { - reviewers.add("clason"); - reviewers.add("gpanders"); - reviewers.add("smjonas"); - } - - if (labels.includes("lsp")) { - reviewers.add("folke"); - reviewers.add("MariaSolOs"); - reviewers.add("mfussenegger"); - } - - if (labels.includes("options")) { - reviewers.add("famiu"); - } - - if (labels.includes("platform:nix")) { - reviewers.add("teto"); - } - - if (labels.includes("project-management")) { - reviewers.add("bfredl"); - reviewers.add("justinmk"); - } - - if (labels.includes("statusline")) { - reviewers.add("famiu"); - } - - if (labels.includes("test")) { - reviewers.add("justinmk"); - } - - if (labels.includes("treesitter")) { - reviewers.add("bfredl"); - reviewers.add("clason"); - reviewers.add("lewis6991"); - } - - if (labels.includes("typo")) { - reviewers.add("dundargoc"); - } - - if (labels.includes("ui")) { - reviewers.add("bfredl"); - reviewers.add("famiu"); - } - - if (labels.includes("vim-patch")) { - reviewers.add("seandewar"); - reviewers.add("zeertzjq"); - } - - // Remove person that opened the PR since they can't review themselves - const pr_opener = pr_data.data.user.login; - reviewers.delete(pr_opener); - - github.rest.pulls.requestReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - reviewers: Array.from(reviewers), - }); -}; diff --git a/.github/workflows/add-reviewers.yml b/.github/workflows/add-reviewers.yml deleted file mode 100644 index 22c68b6ef7..0000000000 --- a/.github/workflows/add-reviewers.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: "Request reviews" -on: - pull_request_target: - types: [labeled, ready_for_review, reopened] - workflow_call: -jobs: - request-reviewer: - if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/checkout@v4 - - name: 'Request reviewers' - uses: actions/github-script@v7 - with: - script: | - const script = require('./.github/scripts/reviews.js') - await script({github, context}) diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml deleted file mode 100644 index 181e3a1a41..0000000000 --- a/.github/workflows/api-docs.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Check if any PR needs to run the autogenerate script -name: Autogenerate API docs and types -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - paths: - - 'src/nvim/api/*.[ch]' - - 'src/nvim/eval.lua' - - 'runtime/lua/**.lua' - - 'runtime/doc/**' - -jobs: - regen-api-docs-and-types: - runs-on: ubuntu-latest - if: github.event.pull_request.draft == false - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup - - - name: Install dependencies - run: | - sudo apt-get install -y doxygen python3-msgpack - - - name: Generate docs - run: | - make doc - if [ -n "$(git status --porcelain)" ]; then - echo "::error::Job failed, run 'make doc' and commit your doc changes." - echo "::error::The doc generation produces the following changes:" - git diff --color --exit-code - fi diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 321cd02b0c..3ed5573262 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -1,4 +1,4 @@ -name: Backport +name: backport on: pull_request_target: types: [closed, labeled] diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 033dd5aef4..75c932b0a6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,4 +1,4 @@ -name: "CodeQL" +name: "codeql" concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 998678daf0..db0f878de4 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -1,4 +1,4 @@ -name: Coverity +name: coverity on: schedule: - cron: '10 0 * * *' # Run every day at 00:10 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..c47df46b28 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,32 @@ +name: docs +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'src/nvim/api/*.[ch]' + - 'src/nvim/eval.lua' + - 'runtime/lua/**.lua' + - 'runtime/doc/**' +jobs: + docs: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + + - name: Install dependencies + run: | + sudo apt-get install -y doxygen python3-msgpack + + - name: Generate docs + run: | + make doc + if [ -n "$(git status --porcelain)" ]; then + echo "::error::Job failed, run 'make doc' and commit your doc changes." + echo "::error::The doc generation produces the following changes:" + git diff --color --exit-code + fi diff --git a/.github/workflows/issue-open-check.yml b/.github/workflows/issue-open-check.yml deleted file mode 100644 index eac1c2ee4d..0000000000 --- a/.github/workflows/issue-open-check.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Issue Open Check - -on: - issues: - types: [opened] - -jobs: - issue-open-check: - permissions: - issues: write - runs-on: ubuntu-latest - steps: - - name: check issue title - id: check-issue - uses: actions/github-script@v7 - with: - script: | - const title = context.payload.issue.title; - const titleSplit = title.split(/\s+/).map(e => e.toLowerCase()); - const keywords = ['api', 'treesitter', 'ui', 'lsp']; - var match = new Set(); - for (const keyword of keywords) { - if (titleSplit.includes(keyword)) { - match.add(keyword) - } - } - if (match.size !== 0) { - github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - labels: Array.from(match) - }) - } diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index cd4bd660aa..0000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: "Pull Request Labeler" -on: - pull_request_target: - types: [opened] -jobs: - triage: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - uses: actions/checkout@v4 - - uses: actions/labeler@v5 - with: - configuration-path: .github/scripts/labeler_configuration.yml - - type-scope: - needs: triage - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_REPO: ${{ github.repository }} - PR_NUMBER: ${{ github.event.pull_request.number }} - PR_TITLE: ${{ github.event.pull_request.title }} - steps: - - name: "Extract commit type and add as label" - run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true - - name: "Extract commit scope and add as label" - run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true - - name: "Extract if the PR is a breaking change and add it as label" - run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true - - request-reviewer: - needs: ["triage", "type-scope"] - permissions: - pull-requests: write - uses: ./.github/workflows/add-reviewers.yml diff --git a/.github/workflows/labeler_issue.yml b/.github/workflows/labeler_issue.yml new file mode 100644 index 0000000000..0da4c0f707 --- /dev/null +++ b/.github/workflows/labeler_issue.yml @@ -0,0 +1,31 @@ +name: "labeler: issue" +on: + issues: + types: [opened] +jobs: + labeler: + permissions: + issues: write + runs-on: ubuntu-latest + steps: + - name: check issue title + uses: actions/github-script@v7 + with: + script: | + const title = context.payload.issue.title; + const titleSplit = title.split(/\s+/).map(e => e.toLowerCase()); + const keywords = ['api', 'treesitter', 'ui', 'lsp']; + var match = new Set(); + for (const keyword of keywords) { + if (titleSplit.includes(keyword)) { + match.add(keyword) + } + } + if (match.size !== 0) { + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: Array.from(match) + }) + } diff --git a/.github/workflows/labeler_pr.yml b/.github/workflows/labeler_pr.yml new file mode 100644 index 0000000000..7f2514069e --- /dev/null +++ b/.github/workflows/labeler_pr.yml @@ -0,0 +1,40 @@ +name: "labeler: PR" +on: + pull_request_target: + types: [opened] +jobs: + labeler: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/labeler@v5 + with: + configuration-path: .github/scripts/labeler_configuration.yml + + type-scope: + needs: triage + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_TITLE: ${{ github.event.pull_request.title }} + steps: + - name: "Extract commit type and add as label" + run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true + - name: "Extract commit scope and add as label" + run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true + - name: "Extract if the PR is a breaking change and add it as label" + run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true + + request-reviewer: + needs: ["triage", "type-scope"] + permissions: + pull-requests: write + uses: ./.github/workflows/reviewers_add.yml diff --git a/.github/workflows/lintcommit.yml b/.github/workflows/lintcommit.yml index f27b22f35f..3d140532cd 100644 --- a/.github/workflows/lintcommit.yml +++ b/.github/workflows/lintcommit.yml @@ -1,4 +1,4 @@ -name: "Commit Linter" +name: "lintcommit" on: pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/news.yml b/.github/workflows/news.yml index d4f8e5ad65..09337a0356 100644 --- a/.github/workflows/news.yml +++ b/.github/workflows/news.yml @@ -1,4 +1,4 @@ -name: "news.txt check" +name: "news.txt" on: pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e304196e99..feacb29533 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: release on: schedule: - cron: '5 5 * * *' diff --git a/.github/workflows/remove-reviewers.yml b/.github/workflows/remove-reviewers.yml deleted file mode 100644 index 3fe7493b93..0000000000 --- a/.github/workflows/remove-reviewers.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: "Remove reviewers" -on: - pull_request_target: - types: [converted_to_draft, closed] -jobs: - remove-reviewers: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: actions/checkout@v4 - - name: 'Remove reviewers' - uses: actions/github-script@v7 - with: - script: | - const script = require('./.github/scripts/remove-reviewers.js') - await script({github, context}) diff --git a/.github/workflows/reviewers_add.yml b/.github/workflows/reviewers_add.yml new file mode 100644 index 0000000000..b116bca29b --- /dev/null +++ b/.github/workflows/reviewers_add.yml @@ -0,0 +1,19 @@ +name: "reviewers: add" +on: + pull_request_target: + types: [labeled, ready_for_review, reopened] + workflow_call: +jobs: + request-reviewer: + if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v4 + - name: 'Request reviewers' + uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/reviewers_add.js') + await script({github, context}) diff --git a/.github/workflows/reviewers_remove.yml b/.github/workflows/reviewers_remove.yml new file mode 100644 index 0000000000..b10d8c3d23 --- /dev/null +++ b/.github/workflows/reviewers_remove.yml @@ -0,0 +1,17 @@ +name: "reviewers: remove" +on: + pull_request_target: + types: [converted_to_draft, closed] +jobs: + remove-reviewers: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v4 + - name: 'Remove reviewers' + uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/reviewers_remove.js') + await script({github, context}) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 941393497a..43fd76dd39 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -104,14 +104,14 @@ jobs: { runner: ubuntu-22.04, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON }, { runner: ubuntu-22.04, cc: gcc }, { runner: macos-12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER }, - { runner: ubuntu-22.04, flavor: functionaltest-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON }, + { runner: ubuntu-22.04, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON }, ] test: [unittest, functionaltest, oldtest] exclude: - test: unittest build: { flavor: tsan } - test: unittest - build: { flavor: functionaltest-lua } + build: { flavor: puc-lua } - test: oldtest build: { flavor: tsan } runs-on: ${{ matrix.build.runner }} diff --git a/.github/workflows/vim-patches.yml b/.github/workflows/vim-patches.yml deleted file mode 100644 index 711ddae815..0000000000 --- a/.github/workflows/vim-patches.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: vim-patches -on: - schedule: - - cron: '3 3 * * *' - workflow_dispatch: - -jobs: - update-vim-patches: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - env: - VIM_SOURCE_DIR: ${{ github.workspace }}/vim-src - VERSION_BRANCH: marvim/ci-version-update - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/checkout@v4 - with: - repository: vim/vim - path: ${{ env.VIM_SOURCE_DIR }} - fetch-depth: 0 - - - run: sudo apt-get install libfuse2 - - - 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: Set up 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 -V1 -es -i NONE +'luafile scripts/vimpatch.lua' +q - printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT - - - 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 --draft --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true diff --git a/.github/workflows/vim_patches.yml b/.github/workflows/vim_patches.yml new file mode 100644 index 0000000000..711ddae815 --- /dev/null +++ b/.github/workflows/vim_patches.yml @@ -0,0 +1,55 @@ +name: vim-patches +on: + schedule: + - cron: '3 3 * * *' + workflow_dispatch: + +jobs: + update-vim-patches: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + env: + VIM_SOURCE_DIR: ${{ github.workspace }}/vim-src + VERSION_BRANCH: marvim/ci-version-update + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/checkout@v4 + with: + repository: vim/vim + path: ${{ env.VIM_SOURCE_DIR }} + fetch-depth: 0 + + - run: sudo apt-get install libfuse2 + + - 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: Set up 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 -V1 -es -i NONE +'luafile scripts/vimpatch.lua' +q + printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT + + - 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 --draft --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true -- cgit