Skip to content

Commit cdfd0d5

Browse files
committed
I hate this syntax, so much
1 parent e354d13 commit cdfd0d5

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,23 @@ jobs:
202202
fi
203203
done
204204
echo '\n</details>' >> summary.md
205-
SUMMARY_BODY=$(cat summary.md)
206-
SUMMARY_BODY_ESCAPED=$(printf '%s' "$SUMMARY_BODY" | sed -e ':a' -e 'N' -e '$!ba' -e 's/%/%25/g' -e 's/\n/%0A/g' -e 's/\r/%0D/g')
207-
echo "body=$SUMMARY_BODY_ESCAPED" >> $GITHUB_OUTPUT
205+
# Set multiline output without manual percent-encoding (new Actions syntax)
206+
{
207+
echo 'body<<EOF'
208+
cat summary.md
209+
echo 'EOF'
210+
} >> $GITHUB_OUTPUT
208211
209212
- name: Create or update PR comment
210213
uses: actions/github-script@v7
211214
with:
212215
script: |
213216
const markerStart = '<!-- smoke-test-report-start -->';
214217
const markerEnd = '<!-- smoke-test-report-end -->';
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;
218+
const raw = process.env.SUMMARY_BODY && process.env.SUMMARY_BODY.trim().length
219+
? process.env.SUMMARY_BODY
220+
: 'Smoke test summary not available.';
221+
const body = raw;
224222
const { owner, repo, number } = context.issue;
225223
const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: number, per_page: 100 });
226224
const existing = comments.find(c => c.body && c.body.includes(markerStart));

0 commit comments

Comments
 (0)