[wip] [ci] doc-job-skip take #4 dry-run (#8980)

* ci-doc-job-skip-take-4

* wip

* wip

* wip

* wip

* skip yaml

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* ready to test

* yet another way

* trying with HEAD

* trying with head.sha

* trying with head.sha fix

* trying with head.sha fix wip

* undo

* try to switch to sha

* current branch

* current branch

* PR number check

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride

* joy ride
This commit is contained in:
Stas Bekman 2020-12-09 12:36:36 -08:00 committed by GitHub
parent 06971ac4f9
commit 5e637e6c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,21 +11,40 @@ commands:
- run: - run:
name: docs-only changes skip check name: docs-only changes skip check
command: | command: |
# pipeline.git.base_revision is not always defined, so only proceed if all external vars are defined if test -n "$CIRCLE_PR_NUMBER"
if test -n "<< pipeline.git.base_revision >>" && test -n "<< pipeline.git.revision >>" && test -n "$(git diff --name-only << pipeline.git.base_revision >>...<< pipeline.git.revision >>)"
then then
if git diff --name-only << pipeline.git.base_revision >>...<< pipeline.git.revision >> | egrep -qv '\.(md|rst)$' echo $CIRCLE_PR_NUMBER
resp=$(curl -Ls https://api.github.com/repos/huggingface/transformers/pulls/${CIRCLE_PR_NUMBER})
user=$(jq -r .user.login \<<< $resp) # PR creator username
head_ref=$(jq -r .head.ref \<<< $resp) # PR user's branch name
echo head_ref=$head_ref, user=$user
fi
if test -n "$user" && test -n "$head_ref"
then
git clone https://github.com/$user/transformers user-clone
cd user-clone
git checkout $head_ref
fork_point_sha=$(git merge-base --fork-point master)
cd -
fi
if test -n "$fork_point_sha" && test -n "$(git diff --name-only $fork_point_sha)"
then
git --no-pager diff --name-only $fork_point_sha
if git diff --name-only $fork_point_sha | egrep -qv '\.(md|rst)$'
then then
echo "Non-docs were modified in this PR, proceeding normally" echo "Non-docs were modified in this PR, proceeding normally"
else else
echo "Only docs were modified in this PR, quitting this job" echo "Only docs were modified in this PR, quitting this job"
# disable skipping for now, as circleCI's base_revision is inconsistent leading to invalid ranges # enable skipping once we get this sorted out
# circleci step halt # circleci step halt
fi fi
else else
echo "Can't perform skipping check w/o base_revision defined, continuing the job" echo "Not enough data to perform a skipping check - continuing the job"
fi fi
# TPU REFERENCES # TPU REFERENCES
references: references:
checkout_ml_testing: &checkout_ml_testing checkout_ml_testing: &checkout_ml_testing