[libgweather/style-check-feedback: 4/6] ci: Post the style check output as a comment on the MR
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/style-check-feedback: 4/6] ci: Post the style check output as a comment on the MR
- Date: Tue, 19 Oct 2021 15:29:41 +0000 (UTC)
commit e7f84f005f1dd8127a8fa0a29b859e1e1fd362cb
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Oct 19 14:36:37 2021 +0100
ci: Post the style check output as a comment on the MR
If the job is part of a merge request.
.gitlab-ci/run-style-check.sh | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/.gitlab-ci/run-style-check.sh b/.gitlab-ci/run-style-check.sh
index 86c142b8..b47ea3fd 100755
--- a/.gitlab-ci/run-style-check.sh
+++ b/.gitlab-ci/run-style-check.sh
@@ -14,19 +14,20 @@ git diff -U0 --no-color "${newest_common_ancestor_sha}" libgweather/*.c libgweat
)
exit_status=$?
+[ ${exit_status} == 0 ] || exit ${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
+ echo 'body=```diff' > format.log
+ cat format-diff.log >> format.log
+ echo '```' >> format.log
+ [ -n "$CI_MERGE_REQUEST_IID" ] && curl \
+ --request POST \
+ --header "Private-Token: $STYLE_CHECK_TOKEN" \
+ --data-urlencode "$(<format.log)" \
+ https://gitlab.gnome.org/api/v4/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes \
+ --insecure
+ unlink format.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]