Skip to content

Commit d71d6bc

Browse files
committed
Add --verbose option
1 parent aa47a39 commit d71d6bc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pr-checks/sync-checks.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ interface Options {
2424
ref?: string;
2525
/** Whether to actually apply the changes or not. */
2626
apply: boolean;
27+
/** Whether to output additional information. */
28+
verbose: boolean;
2729
}
2830

2931
/** Identifies the CodeQL Action repository. */
@@ -69,10 +71,13 @@ export interface CheckInfo {
6971

7072
/** Removes entries from `checkInfos` based the configuration. */
7173
export function removeExcluded(
74+
options: Options,
7275
exclusions: Exclusions,
7376
checkInfos: CheckInfo[],
7477
): CheckInfo[] {
75-
console.log(exclusions);
78+
if (options.verbose) {
79+
console.log(exclusions);
80+
}
7681

7782
return checkInfos.filter((checkInfo) => {
7883
if (exclusions.is.includes(checkInfo.context)) {
@@ -98,6 +103,7 @@ export function removeExcluded(
98103

99104
/** Gets a list of check run names for `ref`. */
100105
async function getChecksFor(
106+
options: Options,
101107
client: ApiClient,
102108
ref: string,
103109
): Promise<CheckInfo[]> {
@@ -133,7 +139,7 @@ async function getChecksFor(
133139
// Load the configuration for which checks to exclude and apply it before
134140
// returning the checks.
135141
const exclusions = loadExclusions();
136-
return removeExcluded(exclusions, checkInfos);
142+
return removeExcluded(options, exclusions, checkInfos);
137143
}
138144

139145
/** Gets the current list of release branches. */
@@ -224,6 +230,11 @@ async function main(): Promise<void> {
224230
type: "boolean",
225231
default: false,
226232
},
233+
// Whether to output additional information.
234+
verbose: {
235+
type: "boolean",
236+
default: false,
237+
},
227238
},
228239
strict: true,
229240
});
@@ -244,7 +255,7 @@ async function main(): Promise<void> {
244255

245256
// Find the check runs for the specified `ref` that we will later set as the required checks
246257
// for the main and release branches.
247-
const checkInfos = await getChecksFor(client, options.ref);
258+
const checkInfos = await getChecksFor(options, client, options.ref);
248259
const checkNames = new Set(checkInfos.map((info) => info.context));
249260

250261
// Update the main branch.

0 commit comments

Comments
 (0)