mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
The "eclair" script calls action_push.sh even for merge request, while instead action_pull_request.sh should be called, resulting in a job failure with this error: Unexpected event pull_request Fix the script to call action_pull_request.sh appropriately. Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> Reviewed-by: Simone Ballarin <simone.ballarin@bugseng.com>
58 lines
1.6 KiB
Bash
Executable File
58 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
usage() {
|
|
echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2
|
|
exit 2
|
|
}
|
|
|
|
[ $# -eq 2 ] || usage
|
|
|
|
wtoken=$1
|
|
analysisOutputDir=$2
|
|
|
|
# Load settings and helpers
|
|
. "$(dirname "$0")/action.helpers"
|
|
. "$(dirname "$0")/action.settings"
|
|
|
|
curl -sS "${eclairReportUrlPrefix}/ext/update_pull_request" \
|
|
-F "wtoken=${wtoken}" \
|
|
-F "artifactsDir=${artifactsDir}" \
|
|
-F "subDir=${subDir}" \
|
|
-F "jobId=${jobId}" \
|
|
-F "jobHeadline=${jobHeadline}" \
|
|
-F "baseCommitId=${baseCommitId}" \
|
|
-F "keepOldAnalyses=${keepOldAnalyses}" \
|
|
-F "db=@${analysisOutputDir}/PROJECT.ecd" \
|
|
>"${updateLog}"
|
|
ex=0
|
|
grep -Fq "unfixedReports: " "${updateLog}" || ex=$?
|
|
maybe_log_file_exit PUBLISH_RESULT "Publishing results" "${updateLog}" "${ex}"
|
|
|
|
summary
|
|
|
|
if is_enabled "${ENABLE_ECLAIR_BOT:-}"; then
|
|
case ${ci} in
|
|
github)
|
|
ex=0
|
|
gh api \
|
|
--method POST \
|
|
"/repos/${repository}/issues/${pullRequestId}/comments" \
|
|
-F "body=@${summaryTxt}" \
|
|
--silent >"${commentLog}" 2>&1 || ex=$?
|
|
maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}"
|
|
;;
|
|
gitlab)
|
|
curl -sS --request POST \
|
|
"${gitlabApiUrl}/projects/${CI_PROJECT_ID}/merge_requests/${pullRequestId}/notes" \
|
|
-H "PRIVATE-TOKEN: ${gitlabBotToken}" \
|
|
-F "body=<${summaryTxt}" >"${commentLog}"
|
|
ex=0
|
|
grep -Fq "Unfixed reports: " "${commentLog}" || ex=$?
|
|
maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}"
|
|
;;
|
|
*) ;;
|
|
esac
|
|
fi
|