From 151abb533c7e0039202ac1cb634a7ba729563424 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Wed, 13 Nov 2019 12:14:16 -0500 Subject: [PATCH] ceph-ansible-prs: update docs skip condition 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 --- .../config/definitions/ceph-ansible-prs.yml | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/ceph-ansible-prs/config/definitions/ceph-ansible-prs.yml b/ceph-ansible-prs/config/definitions/ceph-ansible-prs.yml index 43829686..bc735a11 100644 --- a/ceph-ansible-prs/config/definitions/ceph-ansible-prs.yml +++ b/ceph-ansible-prs/config/definitions/ceph-ansible-prs.yml @@ -161,10 +161,13 @@ #!/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: @@ -256,10 +259,13 @@ #!/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: @@ -351,10 +357,13 @@ #!/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: -- 2.39.5