-
Notifications
You must be signed in to change notification settings - Fork 408
Render AWF reflect output in both Step Summary and action outputs #34698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5761ce6
d2fdbfc
479c6f2
71514a3
3673818
13e2ce1
44d88be
81ac2a1
39e07c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| // @ts-check | ||
| /// <reference types="@actions/github-script" /> | ||
|
|
||
| require("./shim.cjs"); | ||
|
|
||
| const fs = require("fs"); | ||
|
|
||
| const AWF_CONFIG_PATH = "/tmp/gh-aw/awf-config.json"; | ||
|
|
@@ -260,6 +262,8 @@ async function main() { | |
| } | ||
|
|
||
| const markdown = buildReflectSummary(reflectData, { awfConfigData, runtimeModelsData }); | ||
| // shim.cjs ensures core.summary.addRaw()/write() are available in environments | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Smoke review note: good shim use here. It keeps summary output alive when native step-summary APIs missing. |
||
| // without native GitHub Actions step-summary support. | ||
| await core.summary.addRaw(markdown).write(); | ||
| core.info("AWF reflect summary written to step summary"); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,16 @@ if (!global.core) { | |
| }; | ||
| } | ||
|
|
||
| const coreSummary = global.core.summary && typeof global.core.summary === "object" ? global.core.summary : (global.core.summary = {}); | ||
|
|
||
| if (typeof coreSummary.addRaw !== "function") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Smoke review note: this no-op summary fallback is small and safe for non-Actions contexts. |
||
| coreSummary.addRaw = () => coreSummary; | ||
| } | ||
|
|
||
| if (typeof coreSummary.write !== "function") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fallback |
||
| coreSummary.write = async () => {}; | ||
| } | ||
|
|
||
| if (!global.context) { | ||
| // Build a context object from GitHub Actions environment variables, | ||
| // mirroring the shape of @actions/github's Context class. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice — eagerly requiring
./shim.cjshere ensurescore.summary.addRaw()/write()are always defined beforemain()runs. Consider asserting that the shim is idempotent so repeated requires from other entrypoints stay safe. Automated smoke-test feedback.