Created
December 4, 2019 17:23
-
-
Save Ch4s3/9078c0f6649e6913dff2a2cf78b74f72 to your computer and use it in GitHub Desktop.
Revisions
-
Ch4s3 created this gist
Dec 4, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ file_changes="$(git diff --name-only $(git merge-base master HEAD))" migration_files="$(echo $file_changes | grep -c /migrations/)" application_files="$(echo $file_changes | grep -c -v /migrations/ --include \*.ex --include \*.exs)" echo "checking for migrations and apllication changes" if (($migration_files == 0)) && (($application_files > 0)); then echo "Only Application Changes. OK" exit 0 elif (("$migration_files" > 0)) && (("$application_files" == 0)); then echo "Only Migrations. OK" exit 0 elif (("$migration_files" == 0)) && (("$application_files" == 0)) then echo "No new code or migrations. OK" exit 0 else echo "PR must contain either code or migrations, but not both" exit 1 fi