]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible-prs: update docs skip condition 1436/head
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 13 Nov 2019 17:14:16 +0000 (12:14 -0500)
committerDimitri Savineau <dsavinea@redhat.com>
Wed, 13 Nov 2019 17:14:16 +0000 (12:14 -0500)
When a PR can't be merged due to conflicts then we can't check if the
last commit is a merge commit.

Commit message: "Merge xxxx into xxxx"

In this case we only checkout the latest commit in the PR without the
previous one if any.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
ceph-ansible-prs/config/definitions/ceph-ansible-prs.yml

index 438296864a67a5979be0af8d297517d0f5bcd823..bc735a115d9b865c7da38381d4748bae6dc24cd7 100644 (file)
             #!/bin/bash
             # Returns 1 if only .rst and README files were modified
             echo "Checking if only rst and READMEs were modified"
-            git diff --name-only $(git show HEAD | grep Merge | head -n 1 | cut -d ':' -f2) | grep -v '\.rst\|README'
-            if [ $? -eq 1 ]; then
-              echo "Only docs were modified.  Skipping the rest of the job."
-              exit 1
+            git show HEAD | grep -qo ^Merge:
+            if [ $? -eq 0 ]; then
+              git diff --name-only $(git show HEAD | grep ^Merge: | cut -d ':' -f2) | grep -v '\.rst\|README'
+              if [ $? -eq 1 ]; then
+                echo "Only docs were modified.  Skipping the rest of the job."
+                exit 1
+              fi
             fi
           on-evaluation-failure: dont-run
           steps:
             #!/bin/bash
             # Returns 1 if only .rst and README files were modified
             echo "Checking if only rst and READMEs were modified"
-            git diff --name-only $(git show HEAD | grep Merge | head -n 1 | cut -d ':' -f2) | grep -v '\.rst\|README'
-            if [ $? -eq 1 ]; then
-              echo "Only docs were modified.  Skipping the rest of the job."
-              exit 1
+            git show HEAD | grep -qo ^Merge:
+            if [ $? -eq 0 ]; then
+              git diff --name-only $(git show HEAD | grep ^Merge: | cut -d ':' -f2) | grep -v '\.rst\|README'
+              if [ $? -eq 1 ]; then
+                echo "Only docs were modified.  Skipping the rest of the job."
+                exit 1
+              fi
             fi
           on-evaluation-failure: dont-run
           steps:
             #!/bin/bash
             # Returns 1 if only .rst and README files were modified
             echo "Checking if only rst and READMEs were modified"
-            git diff --name-only $(git show HEAD | grep Merge | head -n 1 | cut -d ':' -f2) | grep -v '\.rst\|README'
-            if [ $? -eq 1 ]; then
-              echo "Only docs were modified.  Skipping the rest of the job."
-              exit 1
+            git show HEAD | grep -qo ^Merge:
+            if [ $? -eq 0 ]; then
+              git diff --name-only $(git show HEAD | grep ^Merge: | cut -d ':' -f2) | grep -v '\.rst\|README'
+              if [ $? -eq 1 ]; then
+                echo "Only docs were modified.  Skipping the rest of the job."
+                exit 1
+              fi
             fi
           on-evaluation-failure: dont-run
           steps: