mirror of
https://github.com/neovim/nvim-lspconfig
synced 2024-09-16 14:24:07 +02:00
fix(ci): avoid failing "dirname"-cleanup PRs (#1405)
This commit is contained in:
parent
f605c50fe6
commit
f19b12f527
3 changed files with 31 additions and 18 deletions
16
.github/ci/run_sanitizer.sh
vendored
Normal file
16
.github/ci/run_sanitizer.sh
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
REF_BRANCH="$1"
|
||||
PR_BRANCH="$2"
|
||||
|
||||
# checks for added lines that contain search pattern and prints them
|
||||
SEARCH_PATTERN="(dirname|fn\.cwd)"
|
||||
|
||||
if git diff --pickaxe-all -U0 -G "${SEARCH_PATTERN}" "${REF_BRANCH}" "${PR_BRANCH}" -- '*.lua' | grep -Ev '(configs|utils)\.lua$' | grep -E "^\+.*${SEARCH_PATTERN}" ; then
|
||||
echo
|
||||
echo 'String "dirname" found. There is a high risk that this might contradict the directive:'
|
||||
echo '"Do not add vim.fn.cwd or util.path.dirname in root_dir".'
|
||||
echo "see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#adding-a-server-to-lspconfig."
|
||||
exit 1
|
||||
fi
|
18
.github/workflows/check-for-dirname.yml
vendored
18
.github/workflows/check-for-dirname.yml
vendored
|
@ -1,18 +0,0 @@
|
|||
name: "Dirname Checker"
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
dirname-check:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- run: |
|
||||
if ! git log -G"dirname" --exit-code origin/$GITHUB_BASE_REF..$(git branch --show-current) -- . ':!lua/lspconfig/configs.lua'; then
|
||||
echo
|
||||
echo 'String "dirname" found. There is a high risk that this might contradict the directive "Do not add vim.fn.cwd or util.path.dirname in root_dir" specified in https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#adding-a-server-to-lspconfig.'
|
||||
exit 1
|
||||
fi
|
15
.github/workflows/sanitizer.yml
vendored
Normal file
15
.github/workflows/sanitizer.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
name: "Dirname Checker"
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
disallowed-root-checker:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: |
|
||||
if ! bash .github/ci/run_sanitizer.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}; then
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in a new issue