Skip to content

Commit 6242f99

Browse files
authored
Updated WF name in the add-label WF (#36435)
1 parent 2bed7ee commit 6242f99

File tree

2 files changed

+24
-47
lines changed

2 files changed

+24
-47
lines changed

.github/workflows/src/breaking-change-add-label-artifacts.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { PER_PAGE_MAX } from "../../shared/src/github.js";
55
import { byDate, invert } from "../../shared/src/sort.js";
66
import { extractInputs } from "./context.js";
77

8+
export const SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME = "Swagger BreakingChange - Analyze Code";
9+
export const CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME =
10+
"Breaking Change(Cross-Version) - Analyze Code";
11+
812
/**
913
* @param {import('@actions/github-script').AsyncFunctionArguments} AsyncFunctionArguments
1014
* @returns {Promise<void>}
@@ -25,12 +29,12 @@ export default async function getLabelActions({ github, context, core }) {
2529
});
2630

2731
const latestBreakingChangesRun = workflowRuns
28-
.filter((wf) => wf.name === "[TEST-IGNORE] Swagger BreakingChange - Analyze Code")
32+
.filter((wf) => wf.name === SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME)
2933
// Sort by "updated_at" descending
3034
.sort(invert(byDate((wf) => wf.updated_at)))[0];
3135

3236
const latestCrossVersionBreakingChangesRun = workflowRuns
33-
.filter((wf) => wf.name === "[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code")
37+
.filter((wf) => wf.name === CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME)
3438
// Sort by "updated_at" descending
3539
.sort(invert(byDate((wf) => wf.updated_at)))[0];
3640

.github/workflows/test/breaking-change-add-label-artifacts.test.js

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { beforeEach, describe, expect, it, vi } from "vitest";
22
import { REVIEW_REQUIRED_LABELS } from "../../shared/src/breaking-change.js";
33
import { PER_PAGE_MAX } from "../../shared/src/github.js";
4-
import getLabelActions from "../src/breaking-change-add-label-artifacts.js";
4+
import getLabelActions, {
5+
CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME,
6+
SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME,
7+
} from "../src/breaking-change-add-label-artifacts.js";
58
import { createMockContext, createMockCore, createMockGithub } from "./mocks.js";
69

710
// Mock dependencies
@@ -66,18 +69,8 @@ describe("breaking-change-add-label-artifacts", () => {
6669
};
6770

6871
const createStandardWorkflowRuns = () => [
69-
createMockWorkflowRun(
70-
"[TEST-IGNORE] Swagger BreakingChange - Analyze Code",
71-
"completed",
72-
"success",
73-
1,
74-
),
75-
createMockWorkflowRun(
76-
"[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code",
77-
"completed",
78-
"success",
79-
2,
80-
),
72+
createMockWorkflowRun(SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME, "completed", "success", 1),
73+
createMockWorkflowRun(CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME, "completed", "success", 2),
8174
];
8275

8376
const expectStandardOutputs = (breakingChangeValue, versioningValue) => {
@@ -110,14 +103,14 @@ describe("breaking-change-add-label-artifacts", () => {
110103

111104
const mockWorkflowRuns = [
112105
createMockWorkflowRun(
113-
"[TEST-IGNORE] Swagger BreakingChange - Analyze Code",
106+
SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME,
114107
"completed",
115108
"success",
116109
1,
117110
"2024-01-01T12:00:00Z",
118111
),
119112
createMockWorkflowRun(
120-
"[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code",
113+
CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME,
121114
"completed",
122115
"success",
123116
2,
@@ -206,14 +199,9 @@ describe("breaking-change-add-label-artifacts", () => {
206199
await setupMockInputs();
207200

208201
const mockWorkflowRuns = [
202+
createMockWorkflowRun(SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME, "in_progress", null, 1),
209203
createMockWorkflowRun(
210-
"[TEST-IGNORE] Swagger BreakingChange - Analyze Code",
211-
"in_progress",
212-
null,
213-
1,
214-
),
215-
createMockWorkflowRun(
216-
"[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code",
204+
CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME,
217205
"completed",
218206
"success",
219207
2,
@@ -231,18 +219,8 @@ describe("breaking-change-add-label-artifacts", () => {
231219
await setupMockInputs();
232220

233221
const mockWorkflowRuns = [
234-
createMockWorkflowRun(
235-
"[TEST-IGNORE] Swagger BreakingChange - Analyze Code",
236-
"completed",
237-
"success",
238-
1,
239-
),
240-
createMockWorkflowRun(
241-
"[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code",
242-
"queued",
243-
null,
244-
2,
245-
),
222+
createMockWorkflowRun(SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME, "completed", "success", 1),
223+
createMockWorkflowRun(CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME, "queued", null, 2),
246224
];
247225

248226
setupWorkflowRunsMock(mockWorkflowRuns);
@@ -257,7 +235,7 @@ describe("breaking-change-add-label-artifacts", () => {
257235

258236
const mockWorkflowRuns = [
259237
createMockWorkflowRun(
260-
"[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code",
238+
CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME,
261239
"completed",
262240
"success",
263241
2,
@@ -278,12 +256,7 @@ describe("breaking-change-add-label-artifacts", () => {
278256
await setupMockInputs();
279257

280258
const mockWorkflowRuns = [
281-
createMockWorkflowRun(
282-
"[TEST-IGNORE] Swagger BreakingChange - Analyze Code",
283-
"completed",
284-
"success",
285-
1,
286-
),
259+
createMockWorkflowRun(SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME, "completed", "success", 1),
287260
createMockWorkflowRun("Other Workflow", "completed", "success", 3),
288261
];
289262

@@ -421,15 +394,15 @@ describe("breaking-change-add-label-artifacts", () => {
421394
const mockWorkflowRuns = [
422395
{
423396
...createMockWorkflowRun(
424-
"[TEST-IGNORE] Swagger BreakingChange - Analyze Code",
397+
SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME,
425398
"completed",
426399
"failure",
427400
1,
428401
),
429402
},
430403
{
431404
...createMockWorkflowRun(
432-
"[TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code",
405+
CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME,
433406
"in_progress",
434407
null,
435408
2,
@@ -445,10 +418,10 @@ describe("breaking-change-add-label-artifacts", () => {
445418

446419
// Should log status for in_progress and conclusion for completed
447420
expect(mockCore.info).toHaveBeenCalledWith(
448-
"- [TEST-IGNORE] Swagger BreakingChange - Analyze Code: failure",
421+
`- ${SWAGGER_BREAKING_CHANGE_WORKFLOW_NAME}: failure`,
449422
);
450423
expect(mockCore.info).toHaveBeenCalledWith(
451-
"- [TEST-IGNORE] Breaking Change(Cross-Version) - Analyze Code: in_progress",
424+
`- ${CROSS_VERSION_BREAKING_CHANGE_WORKFLOW_NAME}: in_progress`,
452425
);
453426
});
454427
});

0 commit comments

Comments
 (0)