@@ -28,22 +28,33 @@ jobs:
2828 - name : Run lint
2929 id : lint
3030 continue-on-error : true
31- run : |
32- bun run lint 2>&1 | tee lint-output.txt
33- echo "exit_code=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT
31+ shell : bash
3432 working-directory : packages/cli
33+ run : |
34+ set -o pipefail
35+ bun run lint 2>&1 | tee "$GITHUB_WORKSPACE/lint-output.txt"
36+
37+ - name : Upload lint output
38+ if : always()
39+ uses : actions/upload-artifact@v4
40+ with :
41+ name : lint-output
42+ path : lint-output.txt
43+ retention-days : 7
3544
3645 - name : Process results
3746 id : result
47+ shell : bash
3848 run : |
39- if [ "${{ steps.lint.outcome }}" == "success" ]; then
40- echo "status=Passed" >> $GITHUB_OUTPUT
41- echo "details=" >> $GITHUB_OUTPUT
49+ set -euo pipefail
50+ if [ "${{ steps.lint.outcome }}" = "success" ]; then
51+ echo "status=Passed" >> "$GITHUB_OUTPUT"
52+ echo "details=Lint passed" >> "$GITHUB_OUTPUT"
4253 else
43- ERRORS=$(grep -c " error " packages/cli/ lint-output.txt 2>/dev/null || echo "0")
44- WARNINGS=$(grep -c " warning " packages/cli/ lint-output.txt 2>/dev/null || echo "0")
45- echo "status=Failed" >> $GITHUB_OUTPUT
46- echo "details=${ERRORS} errors, ${WARNINGS} warnings" >> $GITHUB_OUTPUT
54+ ERRORS=$(grep -c " error " lint-output.txt 2>/dev/null || echo "0")
55+ WARNINGS=$(grep -c " warning " lint-output.txt 2>/dev/null || echo "0")
56+ echo "status=Failed" >> " $GITHUB_OUTPUT"
57+ echo "details=${ERRORS} errors, ${WARNINGS} warnings" >> " $GITHUB_OUTPUT"
4758 fi
4859
4960 - name : Update PR comment
5667 RUN_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
5768 with :
5869 script : |
70+ const fs = require("fs");
71+
5972 const marker = "<!-- ci-summary -->";
6073 const detailsMarker = "<!-- details-section -->";
6174 const section = process.env.SECTION;
6679 const { owner, repo } = context.repo;
6780 const issue_number = context.payload.pull_request.number;
6881
82+ let output = "";
83+ try {
84+ output = fs.readFileSync("lint-output.txt", "utf8");
85+ } catch (_) {
86+ output = "(lint-output.txt not found)";
87+ }
88+
89+ const MAX_CHARS = 60000;
90+ if (output.length > MAX_CHARS) {
91+ output = [
92+ "(truncated; showing last " + MAX_CHARS + " chars)",
93+ "",
94+ output.slice(-MAX_CHARS),
95+ ].join("\n");
96+ }
97+
6998 const comments = await github.paginate(github.rest.issues.listComments, {
7099 owner, repo, issue_number, per_page: 100,
71100 });
@@ -99,10 +128,25 @@ jobs:
99128 }
100129 }
101130
102- rows[section] = status;
103-
104- if (status === "Failed" && details) {
105- existingDetails[section] = `<details>\n<summary><strong>${section}</strong></summary>\n\n${details}\n\n[View run](${runUrl})\n\n</details>`;
131+ const resultText = status === "Passed" ? "Passed" : "Failed";
132+ rows[section] = status === "Passed" ? resultText : `[${resultText}](${runUrl}) - ${details}`;
133+
134+ if (status === "Failed") {
135+ const detailsBlock = [
136+ `<details>`,
137+ `<summary><strong>${section}</strong> - ${resultText}</summary>`,
138+ "",
139+ details || "",
140+ "",
141+ `[View run](${runUrl})`,
142+ "",
143+ "```text",
144+ output,
145+ "```",
146+ "</details>",
147+ ].join("\n").replace(/\n\n\n+/g, "\n\n");
148+
149+ existingDetails[section] = detailsBlock;
106150 } else {
107151 delete existingDetails[section];
108152 }
0 commit comments