@@ -4,7 +4,7 @@ set +o histexpand
44# Safe Outputs Specification Conformance Checker
55# This script implements automated checks for the Safe Outputs specification
66# Specification: docs/src/content/docs/reference/safe-outputs-specification.md
7- # Version: 1.20 .0 (2026-05-15 )
7+ # Version: 1.21 .0 (2026-05-19 )
88
99set -euo pipefail
1010
@@ -1323,6 +1323,54 @@ check_wtd_abort_outputs() {
13231323}
13241324check_wtd_abort_outputs
13251325
1326+ # TYPE-005: add_comment Status-Comment Reuse Extension (Section 7.1, v1.21.0)
1327+ echo " Running TYPE-005: add_comment Status-Comment Reuse Extension..."
1328+ check_add_comment_status_target () {
1329+ local handler=" actions/setup/js/add_comment.cjs"
1330+ local failed=0
1331+
1332+ # Per spec Section 7.1 (v1.21.0):
1333+ # 1. When target:"status" is set and a reusable status comment ID is available,
1334+ # implementations MUST update the existing issue/PR comment instead of creating a new one.
1335+ # 2. When target:"status" is set but no reusable status comment ID is available,
1336+ # implementations MUST create a new comment.
1337+ # 3. target:"status" and comment_id MUST be rejected for discussion comments.
1338+
1339+ if [ ! -f " $handler " ]; then
1340+ log_high " TYPE-005: add_comment handler missing: $handler "
1341+ return
1342+ fi
1343+
1344+ # Check that target=status handling exists
1345+ if ! grep -qE ' target.*status|status.*target' " $handler " ; then
1346+ log_high " TYPE-005: add_comment handler has no target=status handling (Section 7.1 requirement 1/2)"
1347+ failed=1
1348+ fi
1349+
1350+ # Check that existing comment update path exists (MUST update existing comment when ID available)
1351+ if ! grep -qE ' updateComment|update.*comment|commentIdToReuse|comment_id.*reuse' " $handler " ; then
1352+ log_high " TYPE-005: add_comment handler lacks existing comment update path for status reuse (Section 7.1 requirement 1)"
1353+ failed=1
1354+ fi
1355+
1356+ # Check that fallback to new comment creation exists (MUST create new when no ID available)
1357+ if ! grep -qE ' no reusable status comment|creating a new comment|statusCommentId.*null|statusCommentId.*empty' " $handler " ; then
1358+ log_medium " TYPE-005: add_comment handler may lack fallback new-comment creation for target=status with no ID (Section 7.1 requirement 2)"
1359+ failed=1
1360+ fi
1361+
1362+ # Check that discussion rejection is implemented (MUST reject target=status for discussions)
1363+ if ! grep -qE ' discussion.*reject|only.*issue.*pull.request|issue.*pull.request.*only|not.*discussion' " $handler " ; then
1364+ log_high " TYPE-005: add_comment handler must reject target=status for discussion comments (Section 7.1 requirement 3)"
1365+ failed=1
1366+ fi
1367+
1368+ if [ $failed -eq 0 ]; then
1369+ log_pass " TYPE-005: add_comment handler correctly implements status-comment reuse extension (Section 7.1 v1.21.0)"
1370+ fi
1371+ }
1372+ check_add_comment_status_target
1373+
13261374# Summary
13271375echo " "
13281376echo " =================================================="
0 commit comments