1313
1414// Builds the Markdown body for the PR sticky comment that summarizes how the
1515// `changes` job classified the diff and which suite groups will run / be
16- // skipped.
16+ // skipped. Intended to be invoked from `ci.yml`'s `changes` job so the
17+ // resulting comment reflects the exact classification CI is using; the
18+ // `pr-classify-comment.yml` workflow then downloads the rendered body as
19+ // an artifact and posts it as a sticky PR comment.
1720//
1821// Inputs (env vars):
1922// CLASSIFY_OUTPUT_FILE - KEY=VALUE file produced by classify-changes.sc.
2023// OVERRIDE_OUTPUT_FILE - KEY=VALUE file produced by check-override-keywords.sc.
2124// COMMENT_OUTPUT_FILE - Path to write the rendered Markdown to (default: comment.md).
22- // CLASSIFY_RUN_ID - Run ID of the classification workflow (optional).
23- // CLASSIFY_RUN_URL - URL to the classification workflow run (optional).
24- // CI_RUN_ID - Run ID of the matching CI workflow run (optional).
25- // CI_RUN_URL - URL to the matching CI workflow run, or a fallback.
25+ // CI_RUN_ID - Run ID of the CI workflow run (optional).
26+ // CI_RUN_URL - URL to the CI workflow run (optional).
2627
2728import prclassify .*
2829
@@ -39,8 +40,6 @@ def overrideContributions(signals: Signals): Seq[(OverrideKey, Seq[SuiteGroup])]
3940
4041def renderComment (
4142 signals : Signals ,
42- classifyRunId : Option [String ],
43- classifyRunUrl : Option [String ],
4443 ciRunId : Option [String ],
4544 ciRunUrl : Option [String ]
4645): String =
@@ -87,17 +86,8 @@ def renderComment(
8786 case Some (id) => Some (s " Full CI run: [# $id]( ${ciRunUrl.getOrElse(" " )}) " )
8887 case None => ciRunUrl.map(url => s " Full CI run: $url" )
8988
90- val classifySection : Option [String ] = classifyRunId.map: id =>
91- s " _Classified in run [# $id]( ${classifyRunUrl.getOrElse(" " )})._ "
92-
9389 val sections =
94- Seq (
95- Some (headerSection),
96- Some (suitesSection),
97- overridesSection,
98- ciRunSection,
99- classifySection
100- ).flatten
90+ Seq (Some (headerSection), Some (suitesSection), overridesSection, ciRunSection).flatten
10191
10292 sections.mkString(" \n\n " ) + " \n "
10393
@@ -111,11 +101,15 @@ val commentPath = Env.toAbsolutePath(
111101
112102val body = renderComment(
113103 signals,
114- classifyRunId = Env .opt(EnvNames .ClassifyRunId ),
115- classifyRunUrl = Env .opt(EnvNames .ClassifyRunUrl ),
116104 ciRunId = Env .opt(EnvNames .CiRunId ),
117105 ciRunUrl = Env .opt(EnvNames .CiRunUrl )
118106)
107+ println(
108+ """ Generated comment body:
109+ |-----------------------
110+ |$body
111+ |-----------------------""" .stripMargin
112+ )
119113
120114os.write.over(commentPath, body, createFolders = true )
121115println(s " Wrote comment to $commentPath" )
0 commit comments