Skip to content

Commit

Permalink
[wip] [ci] doc-job-skip take #4 dry-run (#8980)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stas00 authored Dec 9, 2020
1 parent 06971ac commit 5e637e6
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,40 @@ commands:
- run:
name: docs-only changes skip check
command: |
# pipeline.git.base_revision is not always defined, so only proceed if all external vars are defined
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 >>)"
if test -n "$CIRCLE_PR_NUMBER"
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
echo "Non-docs were modified in this PR, proceeding normally"
else
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
fi
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
# TPU REFERENCES
references:
checkout_ml_testing: &checkout_ml_testing
Expand Down

0 comments on commit 5e637e6

Please sign in to comment.