diff --git a/Makefile b/Makefile index f334e444f..41b48faa6 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ REPO := quay.io/quay/quay TAG := $(REPO):$(SHA) MODIFIED_FILES_COUNT = $(shell git diff --name-only origin/master | grep -E .+\.py$ | wc -l) -MODIFIED_FILES = $(shell git diff --name-only origin/master | grep -E .+\.py$ | paste -sd ' ') +GIT_MERGE_BASED = $(shell git merge-base origin/master HEAD) +MODIFIED_FILES = $(shell git diff --name-only $(GIT_MERGE_BASED) | grep -E .+\.py$ | paste -sd ' ') show-modified: echo $(MODIFIED_FILES) @@ -101,7 +102,7 @@ clean: yapf-all: - yapf -r . -p -i -e './data/model/*.py' -e './data/oci_model/*.py' -e './data/migrations/versions/*.py' + yapf -r . -p -i yapf-diff: diff --git a/ci/tasks/style.yaml b/ci/tasks/style.yaml index 173ff85bc..56ea87b4d 100644 --- a/ci/tasks/style.yaml +++ b/ci/tasks/style.yaml @@ -3,11 +3,13 @@ platform: linux inputs: - name: quay-pull-request run: - path: /bin/sh + path: /bin/bash args: - -c - | set -eux pip install --quiet -r quay-pull-request/requirements-dev.txt cd quay-pull-request - yapf -d -r . + export GIT_MERGE_BASED=`git merge-base origin/master HEAD` + export MODIFIED_FILES=`git diff --name-only $(GIT_MERGE_BASED) | grep -E .+\.py$ | paste -sd ' '` + if [ `yapf -d -p $(MODIFIED_FILES) | wc -l` -gt 0 ] ; then false ; else true ;fi