[libgweather/style-check-feedback: 1/2] ci: Redirect clang-format-diff output to a file




commit 59465dd9db3947c845237a8095cfd60d7a6caaf7
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 19 14:15:38 2021 +0100

    ci: Redirect clang-format-diff output to a file
    
    And print the contents of the file. We are going to need this later.

 .gitlab-ci/run-style-check.sh | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci/run-style-check.sh b/.gitlab-ci/run-style-check.sh
index 07b12429..d93b34e4 100755
--- a/.gitlab-ci/run-style-check.sh
+++ b/.gitlab-ci/run-style-check.sh
@@ -9,9 +9,24 @@ ancestor_horizon=28  # days (4 weeks)
 
 source .gitlab-ci/search-common-ancestor.sh
 
-git diff -U0 --no-color "${newest_common_ancestor_sha}" libgweather/*.c libgweather/tests/*.c 
libgweather/tools/*.c | clang-format-diff -p1
+git diff -U0 --no-color "${newest_common_ancestor_sha}" libgweather/*.c libgweather/tests/*.c 
libgweather/tools/*.c | clang-format-diff -p1 > format-diff.log
 
 )
 exit_status=$?
 
+format_diff="$(<format-diff.log)"
+
+if [ ! -z ${format_diff} ]; then
+  echo \`\`\`diff > format-diff.log
+  echo ${format_diff} >> format-diff.log
+  echo \`\`\` >> format-diff.log
+  exit 1
+  #[ -z "$CI_MERGE_REQUEST_IID" ] && curl \
+  #  --request POST \
+  #  --header "Private-Token: $FORMAT_PRIVATE_TOKEN" \
+  #  -d @format-diff.log \
+  #  
https://gitlab.your-server.com/api/v4/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes \
+  #  --insecure
+fi
+
 exit ${exit_status}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]