zentol commented on a change in pull request #12708: URL: https://github.com/apache/flink/pull/12708#discussion_r442712315
########## File path: tools/azure-pipelines/build_properties.sh ########## @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# +# Returns 0 if the change is a documentation-only pull request +# +function is_docs_only_pullrequest() { + # check if it is a pull request: + if [[ ! $BUILD_SOURCEBRANCHNAME == ci_* ]] ; then + return 1 + fi + PR_ID=`echo "$BUILD_SOURCEBRANCHNAME" | cut -f2 -d_` + if ! [[ "$PR_ID" =~ ^[0-9]+$ ]] ; then + echo "ERROR: Extracted PR_ID is not a number, but this: '$PR_ID'" + return 1 + fi + # check if it is docs only pull request: + CHANGES=`curl --silent "https://api.github.com/repos/apache/flink/pulls/$PR_ID/files" | jq -r ".[].filename"` Review comment: > But the worst that can happen here is that we are wasting 4 hours of CI time for a docs only change (because files were added later). This is a case I also wouldn't care about; but it's not the worst case: a build that changes something outside docs/ does not get tested. To solve this we just need to match the commit hashes. https://api.github.com/repos/apache/flink/pulls/12708 contains the head commit of the PR, and number of commits. Compare the hash against the head commit of the ci branch. If they match, `git diff --name-only head..head~${num_commits}`, continue as usual. If the hashes don't match, just run the tests. ---------------------------------------------------------------- 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: us...@infra.apache.org