From 44df1b98cfc6935d295fd0364356dfb8ea8c245c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wdconinc@gmail.com> Date: Sat, 8 Jul 2023 18:05:55 +0000 Subject: [PATCH] feat: demo posting PR comment --- .gitlab-ci.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ab8c2b..9a57a8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,6 +47,29 @@ stages: done ; fi +.report: + image: curlimages/curl:latest + before_script: [] + script: + - | + if [ -n "${GITHUB_PR}" ] ; then + BODY=$( + echo "<details><summary>geoviewer</summary>" ; + for config in ${DETECTOR_CONFIG//,/ } ; do + url=${TARGET_URL/%config%/${config}} ; + echo "- [$config]($url)" ; + done ; + echo "</details>" ; + ) ; + curl \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${GITHUB_REPO_STATUS_TOKEN}" \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${GITHUB_PR}/comments" \ + -d '{"body":"'"${BODY}"'"}' ; + fi + + geoviewer:pending: stage: status-pending extends: .status @@ -105,10 +128,8 @@ convert: report: stage: finish + extends: .report needs: ["convert"] - script: - - echo "It was a success!" - allow_failure: true geoviewer:success: stage: status-report -- GitLab