From af135d4ad704fba7eb3a57cff8a55ee378da8970 Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 6 Jan 2022 22:31:55 +0100 Subject: [PATCH] Fixed CHANGED_FILES --- .woodpecker/.code_standards_check.yml | 7 ++++++- .woodpecker/.license_check.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.code_standards_check.yml b/.woodpecker/.code_standards_check.yml index d348b41af5..f81ab960f7 100644 --- a/.woodpecker/.code_standards_check.yml +++ b/.woodpecker/.code_standards_check.yml @@ -29,5 +29,10 @@ pipeline: check: image: friendicaci/php-cs commands: - - export CHANGED_FILES="$(git diff --name-status ${CI_PREV_COMMIT_SHA}..${CI_COMMIT_SHA} | grep ^A | cut -f2)" + - if [ ! -z "$${CI_COMMIT_PULL_REQUEST}" ]; then + git fetch --no-tags origin ${CI_COMMIT_TARGET_BRANCH}; + export CHANGED_FILES="$(git diff --name-status $(git merge-base FETCH_HEAD origin/${CI_COMMIT_TARGET_BRANCH})..${CI_COMMIT_SHA} | grep ^A | cut -f2)"; + else + export CHANGED_FILES="$(git diff --name-status ${CI_COMMIT_SHA} | grep ^A | cut -f2)"; + fi - /check-php-cs.sh diff --git a/.woodpecker/.license_check.yml b/.woodpecker/.license_check.yml index a22c6067e3..777986544a 100644 --- a/.woodpecker/.license_check.yml +++ b/.woodpecker/.license_check.yml @@ -2,5 +2,10 @@ pipeline: check: image: friendicaci/php-cs commands: - - export CHANGED_FILES="$(git diff --name-status ${CI_PREV_COMMIT_SHA}..${CI_COMMIT_SHA} | grep -i '\.php$' | cut -f2)" + - if [ ! -z "$${CI_COMMIT_PULL_REQUEST}" ]; then + git fetch --no-tags origin ${CI_COMMIT_TARGET_BRANCH}; + export CHANGED_FILES="$(git diff --name-status $(git merge-base FETCH_HEAD origin/${CI_COMMIT_TARGET_BRANCH})..${CI_COMMIT_SHA} | grep -i '\.php$' | cut -f2)"; + else + export CHANGED_FILES="$(git diff --name-status ${CI_COMMIT_SHA} | grep -i '\.php$' | cut -f2)"; + fi - /check-license.sh