trap-logging: don't export markdown logs and GHA summary unless GHA_EXPORT_MD_SUMMARY=yes (try to make unicorns go away)

This commit is contained in:
Ricardo Pardini 2023-08-12 11:42:08 +02:00 committed by Igor
parent 8dbe1d7ab6
commit 24ee25e0c9

View File

@ -96,11 +96,16 @@ function trap_handler_cleanup_logging() {
cat "${ansi_log_file}" | ansi2txt >> "${ascii_log_file}"
fi
# Export Markdown assets.
local target_file="${target_path}/summary-${ARMBIAN_LOG_CLI_ID}-${ARMBIAN_BUILD_UUID}.md"
export_markdown_logs "${ascii_log_file}" # it might include the ASCII as well, if in GHA.
reset_uid_owner "${target_file}"
local markdown_log_file="${target_file}"
# Export Markdown assets, but not if in GHA and GHA_EXPORT_MD_SUMMARY != yes
if [[ "${CI}" == "true" ]] && [[ "${GITHUB_ACTIONS}" == "true" ]] && [[ "${GHA_EXPORT_MD_SUMMARY:-no}" != "yes" ]]; then
display_alert "Not exporting Markdown logs to GitHub Actions" "GITHUB_ACTIONS: '${GITHUB_ACTIONS}', GHA_EXPORT_MD_SUMMARY: '${GHA_EXPORT_MD_SUMMARY}'" "debug"
else
# Export Markdown logs.
local target_file="${target_path}/summary-${ARMBIAN_LOG_CLI_ID}-${ARMBIAN_BUILD_UUID}.md"
export_markdown_logs "${ascii_log_file}" # it might include the ASCII as well, if in GHA.
reset_uid_owner "${target_file}"
local markdown_log_file="${target_file}"
fi
# Export raw logs, in a tar. For development.
if [[ "${RAW_LOG:-no}" == "yes" ]]; then
@ -109,8 +114,8 @@ function trap_handler_cleanup_logging() {
reset_uid_owner "${target_file}"
fi
# If running in Github Actions, cat the markdown file to GITHUB_STEP_SUMMARY. It appends, docker and build logs will be together.
if [[ "${CI}" == "true" ]] && [[ "${GITHUB_ACTIONS}" == "true" ]]; then
# If running in Github Actions, and GHA_EXPORT_MD_SUMMARY=yes, cat the markdown file to GITHUB_STEP_SUMMARY. It appends, docker and build logs will be together.
if [[ "${CI}" == "true" ]] && [[ "${GITHUB_ACTIONS}" == "true" ]] && [[ "${GHA_EXPORT_MD_SUMMARY:-no}" == "yes" ]]; then
display_alert "Exporting Markdown logs to GitHub Actions" "GITHUB_STEP_SUMMARY: '${GITHUB_STEP_SUMMARY}'" "info"
cat "${markdown_log_file}" >> "${GITHUB_STEP_SUMMARY}" || true
fi