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




commit bcc423e65eadb03e773519d96cdf81caf7431e97
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..86c142b8 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 [ -n "${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]