Commit e3881459 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'docs-pipeline-incremental-tests' into 'master'

Docs pipeline incremental tests

See merge request gitlab-org/gitlab!40828
parents 257f2901 8807bf6c
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment