diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee2a7a10..44438cbb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ rubocop: before_script: - "apk add go-task" script: - - "git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA}...HEAD | grep -v \"^D\" | cut -f 2 | grep \"\.rb$\" | xargs go-task bundle -- exec rubocop" + - "./bin/modified_files | grep \"\.rb$$\" | xargs go-task bundle -- exec rubocop" haml: stage: "lint" rules: @@ -55,4 +55,4 @@ haml: before_script: - "apk add go-task" script: - - "git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA}...HEAD | grep -v \"^D\" | cut -f 2 | grep \"\.haml$\" | xargs go-task bundle -- exec haml-lint" + - "./bin/modified_files | grep \"\.haml$$\" | xargs go-task bundle -- exec haml-lint" diff --git a/bin/modified_files b/bin/modified_files new file mode 100755 index 00000000..0e6a4e08 --- /dev/null +++ b/bin/modified_files @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +test -n "${CI_MERGE_REQUEST_DIFF_BASE_SHA}" + +git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA}...rails \ + | grep -v "^D" \ + | cut -f 2