From bf637bcc5c10ccd2732ff35192fbf09b082386fb Mon Sep 17 00:00:00 2001 From: f Date: Mon, 8 Jan 2024 17:55:46 -0300 Subject: [PATCH] refactor: helper script --- .gitlab-ci.yml | 4 ++-- bin/modified_files | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 bin/modified_files 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