| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | set -eu |
| 4 | |
| 5 | usagescip-shell shell xen 4.20.2+37-g61ff35323e-1 usage().() { |
| 6 | echoscip-shell system . . echo. "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 |
| 7 | exit 2 |
| 8 | } |
| 9 | |
| 10 | [scip-shell system . . `[`. $# -eq 2 ] || usagescip-shell shell xen 4.20.2+37-g61ff35323e-1 usage(). |
| 11 | |
| 12 | wtoken=$1 |
| 13 | analysisOutputDir=$2 |
| 14 | |
| 15 | # Load settings and helpers |
| 16 | . "$(dirnamescip-shell system . . dirname. "$0")/action.helpers" |
| 17 | . "$(dirnamescip-shell system . . dirname. "$0")/action.settings" |
| 18 | |
| 19 | curlscip-shell system . . curl. -sS "${eclairReportUrlPrefix}/ext/update_pull_request" \ |
| 20 | -F "wtoken=${wtoken}" \ |
| 21 | -F "artifactsDir=${artifactsDir}" \ |
| 22 | -F "subDir=${subDir}" \ |
| 23 | -F "jobId=${jobId}" \ |
| 24 | -F "jobHeadline=${jobHeadline}" \ |
| 25 | -F "baseCommitId=${baseCommitId}" \ |
| 26 | -F "keepOldAnalyses=${keepOldAnalyses}" \ |
| 27 | -F "db=@${analysisOutputDir}/PROJECT.ecd" \ |
| 28 | >"${updateLog}" |
| 29 | ex=0 |
| 30 | grepscip-shell system . . grep. -Fq "unfixedReports: " "${updateLog}" || ex=$? |
| 31 | maybe_log_file_exit PUBLISH_RESULT "Publishing results" "${updateLog}" "${ex}" |
| 32 | |
| 33 | summary |
| 34 | |
| 35 | if is_enabled "${ENABLE_ECLAIR_BOT:-}"; then |
| 36 | case ${ci} in |
| 37 | github) |
| 38 | ex=0 |
| 39 | gh api \ |
| 40 | --method POST \ |
| 41 | "/repos/${repository}/issues/${pullRequestId}/comments" \ |
| 42 | -F "body=@${summaryTxt}" \ |
| 43 | --silent >"${commentLog}" 2>&1 || ex=$? |
| 44 | maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}" |
| 45 | ;; |
| 46 | gitlab) |
| 47 | curlscip-shell system . . curl. -sS --request POST \ |
| 48 | "${gitlabApiUrl}/projects/${CI_PROJECT_ID}/merge_requests/${pullRequestId}/notes" \ |
| 49 | -H "PRIVATE-TOKEN: ${gitlabBotToken}" \ |
| 50 | -F "body=<${summaryTxt}" >"${commentLog}" |
| 51 | ex=0 |
| 52 | grepscip-shell system . . grep. -Fq "Unfixed reports: " "${commentLog}" || ex=$? |
| 53 | maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}" |
| 54 | ;; |
| 55 | *) ;; |
| 56 | esac |
| 57 | fi |