diff --git a/lib/functions/logging/trap-logging.sh b/lib/functions/logging/trap-logging.sh index 7b26b3003d..f27a1c7095 100644 --- a/lib/functions/logging/trap-logging.sh +++ b/lib/functions/logging/trap-logging.sh @@ -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