Skip to content

Commit e354d13

Browse files
committed
Hopefully fixes the comment generation
1 parent 62c2e53 commit e354d13

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/pr-smoke-test.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,23 @@ jobs:
212212
script: |
213213
const markerStart = '<!-- smoke-test-report-start -->';
214214
const markerEnd = '<!-- smoke-test-report-end -->';
215-
const body = process.env.SUMMARY_BODY || `\n${{ steps.summary.outputs.body }}`;
216-
const {owner, repo, number} = context.issue;
217-
const { data: comments } = await github.rest.issues.listComments({owner, repo, issue_number: number, per_page: 100});
215+
let raw = process.env.SUMMARY_BODY || '';
216+
if (!raw.trim()) {
217+
raw = 'Smoke test summary not available.';
218+
}
219+
const decoded = raw
220+
.replace(/%25/g, '%')
221+
.replace(/%0D/g, '\r')
222+
.replace(/%0A/g, '\n');
223+
const body = decoded;
224+
const { owner, repo, number } = context.issue;
225+
const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: number, per_page: 100 });
218226
const existing = comments.find(c => c.body && c.body.includes(markerStart));
219227
const finalBody = `${markerStart}\n${body}\n${markerEnd}`;
220228
if (existing) {
221-
await github.rest.issues.updateComment({owner, repo, comment_id: existing.id, body: finalBody});
229+
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body: finalBody });
222230
} else {
223-
await github.rest.issues.createComment({owner, repo, issue_number: number, body: finalBody});
231+
await github.rest.issues.createComment({ owner, repo, issue_number: number, body: finalBody });
224232
}
225233
env:
226234
SUMMARY_BODY: ${{ steps.summary.outputs.body }}

0 commit comments

Comments
 (0)