• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1steps:
2- checkout: self
3  fetchDepth: 5
4
5- script: echo "##vso[task.setvariable variable=diffTarget]HEAD~1"
6  displayName: Set default diff target
7
8- script: |
9    git fetch -q origin $(System.PullRequest.TargetBranch)
10    echo "##vso[task.setvariable variable=diffTarget]HEAD \$(git merge-base HEAD FETCH_HEAD)"
11  displayName: Fetch comparison tree
12  condition: and(succeeded(), variables['System.PullRequest.TargetBranch'])
13
14- script: |
15   if ! git diff --name-only $(diffTarget) | grep -qE '(\.rst$|^Doc|^Misc)'
16   then
17     echo "No docs were updated: docs.run=false"
18     echo "##vso[task.setvariable variable=run;isOutput=true]false"
19   else
20     echo "Docs were updated: docs.run=true"
21     echo "##vso[task.setvariable variable=run;isOutput=true]true"
22   fi
23  displayName: Detect documentation changes
24  name: docs
25
26- script: |
27   if ! git diff --name-only $(diffTarget) | grep -qvE '(\.rst$|^Doc|^Misc)'
28   then
29     echo "Only docs were updated: tests.run=false"
30     echo "##vso[task.setvariable variable=run;isOutput=true]false"
31   else
32     echo "Code was updated: tests.run=true"
33     echo "##vso[task.setvariable variable=run;isOutput=true]true"
34   fi
35  displayName: Detect source changes
36  name: tests
37