diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-02 15:10:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-02 15:10:35 +0300 |
commit | 4fa04f789e6fed5f0dfeafe718eeb7f56a5086e9 (patch) | |
tree | 5ef2d1d8232d3bd359ec79bf95c9a35ce650ae0b /scripts | |
parent | 4b9ace6c1fead1b44f173eaee0cfaa58f46a258a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/lint-doc.sh | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 72e6334d0fc..e4e0e21ca15 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -55,7 +55,18 @@ then ((ERRORCODE++)) fi -MD_DOC_PATH=${MD_DOC_PATH:-doc} +# Run Vale and Markdownlint only on changed files. Only works on merged results +# pipelines, so first checks if a merged results CI variable is present. If not present, +# runs test on all files. +if [ -z "${CI_MERGE_REQUEST_TARGET_BRANCH_SHA}" ] +then + MD_DOC_PATH=${MD_DOC_PATH:-doc} + echo "Merge request pipeline (detached) detected. Testing all files." +else + MERGE_BASE=$(git merge-base ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}) + MD_DOC_PATH=$(git diff --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" '*.md') + echo -e "Merged results pipeline detected. Testing only the following files:\n${MD_DOC_PATH}" + fi function run_locally_or_in_docker() { local cmd=$1 |