Skip to content

Commit 3031e91

Browse files
authored
[verify-run-status] Delete unused workflow and shared code (Azure#38873)
1 parent 9d71a02 commit 3031e91

File tree

5 files changed

+2
-904
lines changed

5 files changed

+2
-904
lines changed

.github/workflows/_reusable-verify-run-status.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/src/github.js

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { PER_PAGE_MAX } from "../../shared/src/github.js";
21
import { toPercent } from "../../shared/src/math.js";
3-
import { byDate, invert } from "../../shared/src/sort.js";
42
import { Duration, formatDuration, getDuration, subtract } from "../../shared/src/time.js";
53

64
/**
@@ -24,83 +22,6 @@ export async function writeToActionsSummary(content, core) {
2422
}
2523
}
2624

27-
/**
28-
* Returns the check with the given checkRunName for the given ref.
29-
* @param {import('@actions/github-script').AsyncFunctionArguments['github']} github
30-
* @param {import('@actions/github-script').AsyncFunctionArguments['context']} context
31-
* @param {string} checkRunName
32-
* @param {string} ref
33-
* @returns {Promise<CheckRuns>}
34-
*/
35-
export async function getCheckRuns(github, context, checkRunName, ref) {
36-
const result = await github.paginate(github.rest.checks.listForRef, {
37-
...context.repo,
38-
ref: ref,
39-
check_name: checkRunName,
40-
status: "completed",
41-
per_page: PER_PAGE_MAX,
42-
});
43-
44-
/* v8 ignore next */
45-
return result.sort(
46-
invert(
47-
byDate((run) => {
48-
if (run.completed_at === null) {
49-
// completed_at should never be null because status is "completed"
50-
throw new Error(`Unexpected value of run.completed_at: '${run.completed_at}'`);
51-
} else {
52-
return run.completed_at;
53-
}
54-
}),
55-
),
56-
);
57-
}
58-
59-
/**
60-
* Returns the check with the given checkRunName for the given ref.
61-
* @param {import('@actions/github-script').AsyncFunctionArguments['github']} github
62-
* @param {import('@actions/github-script').AsyncFunctionArguments['context']} context
63-
* @param {string} commitStatusName
64-
* @param {string} ref
65-
* @returns {Promise<CommitStatuses>}
66-
*/
67-
export async function getCommitStatuses(github, context, commitStatusName, ref) {
68-
const result = await github.paginate(github.rest.repos.listCommitStatusesForRef, {
69-
...context.repo,
70-
ref: ref,
71-
per_page: PER_PAGE_MAX,
72-
});
73-
74-
return result
75-
.filter(
76-
(status) =>
77-
// Property "context" is case-insensitive
78-
status.context.toLowerCase() === commitStatusName.toLowerCase(),
79-
)
80-
.sort(invert(byDate((status) => status.updated_at)));
81-
}
82-
83-
/**
84-
* Returns the workflow run with the given workflowName for the given ref.
85-
* @param {import('@actions/github-script').AsyncFunctionArguments['github']} github
86-
* @param {import('@actions/github-script').AsyncFunctionArguments['context']} context
87-
* @param {string} workflowName
88-
* @param {string} ref
89-
* @returns {Promise<WorkflowRuns>}
90-
*/
91-
export async function getWorkflowRuns(github, context, workflowName, ref) {
92-
const result = await github.paginate(github.rest.actions.listWorkflowRunsForRepo, {
93-
...context.repo,
94-
head_sha: ref,
95-
status: "completed",
96-
per_page: PER_PAGE_MAX,
97-
});
98-
99-
return result
100-
.filter((run) => run.name === workflowName)
101-
.sort(invert(byDate((run) => run.updated_at)));
102-
}
103-
10425
/**
10526
* @param {import("@octokit/endpoint").endpoint} endpoint
10627
* @param {import('../../shared/src/logger.js').ILogger} logger

.github/workflows/src/verify-run-status.js

Lines changed: 0 additions & 199 deletions
This file was deleted.

0 commit comments

Comments
 (0)