jbampton commented on a change in pull request #14391:
URL: https://github.com/apache/flink/pull/14391#discussion_r543407928



##########
File path: tools/azure-pipelines/build_properties.sh
##########
@@ -40,16 +36,47 @@ function is_docs_only_pullrequest() {
        if [[ "$GITHUB_PULL_HEAD_SHA" != "$THIS_BRANCH_SHA" ]] ; then
                echo "INFO: SHA mismatch: 
GITHUB_PULL_HEAD_SHA=$GITHUB_PULL_HEAD_SHA != THIS_BRANCH_SHA=$THIS_BRANCH_SHA";
                # sha mismatch. There's some timing issue, and we can't trust 
the result
-               return 1
+               return 0
        fi
 
        # 3. Get number of commits in PR
        GITHUB_NUM_COMMITS=`echo $GITHUB_PULL_DETAIL | jq -r ".commits"`
 
+       return $GITHUB_NUM_COMMITS
+}
+
+#
+# Returns 0 if the change is a documentation-only pull request
+#
+function is_docs_only_pullrequest() {
+  github_num_commits
+  GITHUB_NUM_COMMITS=$?
+  if [[ $GITHUB_NUM_COMMITS == 0 ]]; then
+    return 1
+  fi
+
        if [[ $(git diff --name-only HEAD..HEAD~$GITHUB_NUM_COMMITS | grep -v 
"docs/") == "" ]] ; then
                echo "INFO: This is a docs only change. Changed files:"
                git diff --name-only HEAD..HEAD~$GITHUB_NUM_COMMITS
                return 0
        fi
        return 1
 }
+
+#
+# Returns 1 if the change contains documentation pull request
+#
+function contains_docs_pullrequest() {
+  github_num_commits
+  GITHUB_NUM_COMMITS=$?
+  if [[ $GITHUB_NUM_COMMITS == 0 ]]; then
+    return 0
+  fi
+
+       if [[ $(git diff --name-only HEAD..HEAD~"$GITHUB_NUM_COMMITS" | grep 
"docs/") != "" ]] ; then
+               echo "INFO: This is a change contains docs. Changed files:"
+               git diff --name-only HEAD..HEAD~"$GITHUB_NUM_COMMITS"
+               return 1
+       fi
+       return 0
+}

Review comment:
       ```suggestion
   }
   
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to