From 877b5cce6fad1d63a42fdc13e83e9430b40672ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 00:57:04 +0000 Subject: [PATCH] Improve pre-agent audit summary tree Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/sh/audit_pre_agent_workspace.sh | 19 +++++++++++++------ .../sh/audit_pre_agent_workspace_test.sh | 14 ++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/actions/setup/sh/audit_pre_agent_workspace.sh b/actions/setup/sh/audit_pre_agent_workspace.sh index 278405a23d3..7b23b1d9e55 100644 --- a/actions/setup/sh/audit_pre_agent_workspace.sh +++ b/actions/setup/sh/audit_pre_agent_workspace.sh @@ -100,25 +100,32 @@ list_dir() { list_dir "gh-aw temp directory" "${RUNNER_TEMP}/gh-aw" } > "${AUDIT_FILE}" -# Render the audit listing as a compact ASCII tree in a fenced code region. +# Render the audit listing as a collapsed, compact tree in the step summary. render_summary_tree() { local line + local label + echo "
" + echo "Pre-agent workspace audit" + echo echo '```text' while IFS= read -r line; do case "${line}" in - "=== "*) echo "Pre-agent workspace audit" ;; + "=== "*) continue ;; "--- "*": "*" ---") - echo "| |-- ${line#--- }" + label="${line#--- }" + echo "│ ├── ${label% ---}" ;; "--- "*" ---") - echo "|-- ${line#--- }" + label="${line#--- }" + echo "├── ${label% ---}" ;; - "(not found)") echo "| | \-- ${line}" ;; + "(not found)") echo "│ │ └── ${line}" ;; "") continue ;; - *) echo "| | \-- ${line}" ;; + *) echo "│ │ └── ${line}" ;; esac done < "${AUDIT_FILE}" echo '```' + echo "
" } LINE_COUNT="$(wc -l < "${AUDIT_FILE}" | tr -d ' ')" diff --git a/actions/setup/sh/audit_pre_agent_workspace_test.sh b/actions/setup/sh/audit_pre_agent_workspace_test.sh index 7dbc3b5dbfe..68b85850db5 100644 --- a/actions/setup/sh/audit_pre_agent_workspace_test.sh +++ b/actions/setup/sh/audit_pre_agent_workspace_test.sh @@ -108,8 +108,8 @@ assert "node_modules excluded from listing" "! grep -q 'node_modules/some-pkg' / assert "agent.md still listed despite node_modules sibling" "grep -q 'agent.md' /tmp/gh-aw/pre-agent-audit.txt" echo "" -# ── Test 8: Step summary tree is rendered ────────────────────────────────── -echo "Test 8: Step summary contains an ASCII tree" +# ── Test 8: Collapsed step summary tree is rendered ───────────────────────── +echo "Test 8: Step summary contains a collapsed tree" WORKSPACE="${TEST_ROOT}/workspace-8" mkdir -p "${WORKSPACE}/.github/agents" echo "agent" > "${WORKSPACE}/.github/agents/agent.md" @@ -122,11 +122,13 @@ touch "${GH_OUT8}" "${SUMMARY8}" GITHUB_WORKSPACE="${WORKSPACE}" HOME="${TEST_ROOT}/home8" RUNNER_TEMP="${TMPDIR}" GITHUB_OUTPUT="${GH_OUT8}" GITHUB_STEP_SUMMARY="${SUMMARY8}" bash "${SCRIPT_PATH}" >/dev/null 2>&1 assert "Summary uses a text code fence" "grep -Fq \"\${FENCE}text\" '${SUMMARY8}'" assert "Summary closes the code fence" "grep -Fq \"\${FENCE}\" '${SUMMARY8}'" -assert "Summary contains the audit root" "grep -Fq 'Pre-agent workspace audit' '${SUMMARY8}'" -assert "Summary contains ASCII tree branches" "grep -Fq '|-- Copilot engine' '${SUMMARY8}'" -assert "Summary lists agent.md in the tree" "grep -Fq '\\-- ${WORKSPACE}/.github/agents/agent.md' '${SUMMARY8}'" +assert "Summary uses details" "grep -Fq '
' '${SUMMARY8}'" +assert "Summary closes details" "grep -Fq '
' '${SUMMARY8}'" +assert "Summary title is in the details summary" "grep -Fq 'Pre-agent workspace audit' '${SUMMARY8}'" +assert "Summary contains tree branches" "grep -Fq '├── Copilot engine' '${SUMMARY8}'" +assert "Summary lists agent.md in the tree" "grep -Fq '└── ${WORKSPACE}/.github/agents/agent.md' '${SUMMARY8}'" assert "Summary does not use a table" "! grep -Fq '| Section | Path | Size |' '${SUMMARY8}'" -assert "Summary does not use details" "! grep -Fq '
' '${SUMMARY8}'" +assert "Summary does not use ASCII branches" "! grep -Fq '|-- Copilot engine' '${SUMMARY8}'" echo "" # ── Test 9: Works without GITHUB_STEP_SUMMARY set ──────────────────────────