Skip to content

Commit a134367

Browse files
authored
[summarize-checks] Add job summary (#36572)
1 parent ce5d7ae commit a134367

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.github/workflows/src/summarize-checks/summarize-checks.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ export async function summarizeChecksImpl(
363363
) {
364364
core.info(`Handling ${event_name} event for PR #${issue_number} in ${owner}/${repo}.`);
365365

366+
const prUrl = `https://github.com/${owner}/${repo}/pull/${issue_number}`;
367+
core.summary.addRaw("PR: ");
368+
core.summary.addLink(prUrl, prUrl);
369+
366370
let labelNames = await getExistingLabels(github, owner, repo, issue_number);
367371

368372
/** @type {[CheckRunData[], CheckRunData[], import("./labelling.js").ImpactAssessment | undefined]} */
@@ -441,6 +445,8 @@ export async function summarizeChecksImpl(
441445
core.info(
442446
`Updating comment '${NEXT_STEPS_COMMENT_ID}' on ${owner}/${repo}#${issue_number} with body: ${commentBody}`,
443447
);
448+
core.summary.addRaw(`\n${commentBody}\n\n`);
449+
444450
// this will remain commented until we're comfortable with the change.
445451
// await commentOrUpdate(
446452
// { github, context, core },
@@ -457,6 +463,11 @@ export async function summarizeChecksImpl(
457463
core.info(
458464
`Summarize checks has identified that status of "[TEST-IGNORE] Automated merging requirements met" commit status should be updated to: ${JSON.stringify(automatedChecksMet)}.`,
459465
);
466+
core.summary.addHeading("Automated Checks Met", 2);
467+
core.summary.addCodeBlock(JSON.stringify(automatedChecksMet, null, 2));
468+
469+
core.summary.write();
470+
core.setOutput("summary", process.env.GITHUB_STEP_SUMMARY);
460471
}
461472

462473
/**

.github/workflows/summarize-checks.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,13 @@ jobs:
6868
const { default: summarizeChecks } =
6969
await import('${{ github.workspace }}/.github/workflows/src/summarize-checks/summarize-checks.js');
7070
return await summarizeChecks({ github, context, core });
71+
72+
# May be used by downstream workflows
73+
- name: Set job-summary artifact
74+
if: ${{ always() && steps.summarize-checks.outputs.summary }}
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: job-summary
78+
path: ${{ steps.summarize-checks.outputs.summary }}
79+
# If the file doesn't exist, just don't add the artifact
80+
if-no-files-found: ignore

0 commit comments

Comments
 (0)