]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-pull-requests: Skip make check on a docs-only PR
authorDavid Galloway <dgallowa@redhat.com>
Wed, 3 Feb 2021 17:49:51 +0000 (12:49 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 3 Feb 2021 17:54:26 +0000 (12:54 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
ceph-pull-requests/build/build
ceph-pull-requests/config/definitions/ceph-pull-requests.yml
scripts/build_utils.sh

index 9377856040bf409115df6d350e91bc9d475f38fb..0c3ccf1dd044b4cc9921852c61fb373185be0e5f 100644 (file)
@@ -1,4 +1,11 @@
 #!/bin/bash -ex
+
+docs_pr_only
+if [ "$DOCS_ONLY" = true ]; then
+    echo "Only the doc/ dir changed.  No need to run make check."
+    exit 0
+fi
+
 export NPROC=$(nproc)
 export WITH_SEASTAR=true
 if which apt-get > /dev/null ; then
index 1ef21979b924b5d00f4ef8f258a6b8c7f5a3911b..14791cd07285bb16c7f5e55fd62555d306d4767f 100644 (file)
@@ -85,3 +85,8 @@
 
     wrappers:
       - ansicolor
+      - credentials-binding:
+          - username-password-separated:
+              credential-id: github-readonly-token
+              username: GITHUB_USER
+              password: GITHUB_PASS
index 8e19686e1ca6baac5ca023b5e8ad13d94204480e..20bc7a07386a01cb82c3b3994019d3d5a59867ba 100644 (file)
@@ -1478,7 +1478,12 @@ docs_pr_only() {
   if ! [[ "$(git config --get remote.origin.url)" =~ "ceph/ceph.git" ]]; then
     cd "$WORKSPACE/ceph"
   fi
-  files="$(git diff --name-only origin/${ghprbTargetBranch}...origin/pr/${ghprbPullId}/head)"
+  if [ -f $(git rev-parse --git-dir)/shallow ]; then
+    # We can't do a regular `git diff` in a shallow clone.  There is no other way to check files changed.
+    files="$(curl -s -u ${GITHUB_USER}:${GITHUB_PASS} https://api.github.com/repos/${ghprbGhRepository}/pulls/${ghprbPullId}/files | jq '.[].filename' | tr -d '"')"
+  else
+    files="$(git diff --name-only origin/${ghprbTargetBranch}...origin/pr/${ghprbPullId}/head)"
+  fi
   echo -e "changed files:\n$files"
   if [ $(echo "$files" | grep -v '^doc/' | wc -l) -gt 0 ]; then
       DOCS_ONLY=false