Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
explicitly handle 0 required checks
  • Loading branch information
scbedd committed Aug 4, 2025
commit 45c0fee5c07185858f179c064fcd1ab8e4f8dc8d
10 changes: 6 additions & 4 deletions .github/workflows/src/summarize-checks/summarize-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,10 +882,12 @@ export async function createNextStepsComment(

// determine if required runs have any in-progress or queued runs
// if there are any, we consider the requirements not met.
const requiredCheckInfosPresent = requiredRuns.some((run) => {
const status = run.status.toLowerCase();
return status !== "queued" && status !== "in_progress";
});
const requiredCheckInfosPresent =
requiredRuns.some((run) => {
const status = run.status.toLowerCase();
return status !== "queued" && status !== "in_progress";
}) || requiredCheckInfos.length === 0;

const fyiCheckInfos = fyiRuns
.filter((run) => checkRunIsSuccessful(run) === false)
.map((run) => run.checkInfo);
Expand Down
125 changes: 124 additions & 1 deletion .github/workflows/test/summarize-checks/summarize-checks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("Summarize Checks Integration Tests", () => {
async () => {
const issue_number = 36258;
const owner = "Azure";
const repo = "azure-rest-api-specs";
const repo = "azure-rest-api-specs-pr";

const ignorableLabels = [
"VersioningReviewRequired",
Expand Down Expand Up @@ -557,6 +557,129 @@ describe("Summarize Checks Unit Tests", () => {
expect(output).toEqual(expectedOutput);
});

it("should generate completed summary with completed required checks but in-progress FYI", async () => {
const repo = "azure-rest-api-specs";
const targetBranch = "main";
const labelNames = [];
const expectedOutput = [
'<h2>Next Steps to Merge</h2>✅ All automated merging requirements have been met! To get your PR merged, see <a href="https://aka.ms/azsdk/specreview/merge">aka.ms/azsdk/specreview/merge</a>.',
{
name: "[TEST-IGNORE] Automated merging requirements met",
result: "SUCCESS",
summary: `✅ All automated merging requirements have been met.<br/>To merge this PR, refer to <a href="https://aka.ms/azsdk/specreview/merge">aka.ms/azsdk/specreview/merge</a>.<br/>For help, consult comments on this PR and see [aka.ms/azsdk/pr-getting-help](https://aka.ms/azsdk/pr-getting-help).`,
},
];

const requiredCheckRuns = [
{
name: "SpellCheck",
status: "COMPLETED",
conclusion: "SUCCESS",
checkInfo: getCheckInfo("SpellCheck"),
},
{
name: "TypeSpec Requirement",
status: "COMPLETED",
conclusion: "SUCCESS",
checkInfo: getCheckInfo("TypeSpec Requirement"),
},
];

const fyiCheckRuns = [
{
name: "Swagger Avocado",
status: "QUEUED",
conclusion: null,
checkInfo: {
precedence: 1,
name: "Swagger Avocado",
suppressionLabels: [],
troubleshootingGuide:
"Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the <a href=\"https://aka.ms/ci-fix\">aka.ms/ci-fix</a> guide",
},
},
{
name: "license/cla",
status: "IN_PROGRESS",
conclusion: null,
checkInfo: {
precedence: 0,
name: "license/cla",
suppressionLabels: [],
troubleshootingGuide:
"Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the <a href=\"https://aka.ms/ci-fix\">aka.ms/ci-fix</a> guide",
},
},
];

const output = await createNextStepsComment(
mockCore,
repo,
labelNames,
targetBranch,
requiredCheckRuns,
fyiCheckRuns,
true, // assessmentCompleted
);

expect(output).toEqual(expectedOutput);
});

it("should generate completed summary with 0 required checks but in-progress FYI", async () => {
const repo = "azure-rest-api-specs";
const targetBranch = "main";
const labelNames = [];
const expectedOutput = [
'<h2>Next Steps to Merge</h2>✅ All automated merging requirements have been met! To get your PR merged, see <a href="https://aka.ms/azsdk/specreview/merge">aka.ms/azsdk/specreview/merge</a>.',
{
name: "[TEST-IGNORE] Automated merging requirements met",
result: "SUCCESS",
summary: `✅ All automated merging requirements have been met.<br/>To merge this PR, refer to <a href="https://aka.ms/azsdk/specreview/merge">aka.ms/azsdk/specreview/merge</a>.<br/>For help, consult comments on this PR and see [aka.ms/azsdk/pr-getting-help](https://aka.ms/azsdk/pr-getting-help).`,
},
];

const requiredCheckRuns = [];

const fyiCheckRuns = [
{
name: "Swagger Avocado",
status: "QUEUED",
conclusion: null,
checkInfo: {
precedence: 1,
name: "Swagger Avocado",
suppressionLabels: [],
troubleshootingGuide:
"Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the <a href=\"https://aka.ms/ci-fix\">aka.ms/ci-fix</a> guide",
},
},
{
name: "license/cla",
status: "IN_PROGRESS",
conclusion: null,
checkInfo: {
precedence: 0,
name: "license/cla",
suppressionLabels: [],
troubleshootingGuide:
"Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the <a href=\"https://aka.ms/ci-fix\">aka.ms/ci-fix</a> guide",
},
},
];

const output = await createNextStepsComment(
mockCore,
repo,
labelNames,
targetBranch,
requiredCheckRuns,
fyiCheckRuns,
true, // assessmentCompleted
);

expect(output).toEqual(expectedOutput);
});

it("should extract check info from raw check response data", async () => {
const expectedCheckRunId = 16582733356;
const response = await import("./fixtures/RawGraphQLResponse.json", {
Expand Down