Skip to content

Commit 22319bb

Browse files
committed
add env to ignore check runs by names
1 parent 0b86a3b commit 22319bb

4 files changed

Lines changed: 17 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ disgit has the following optional environment variables that you can use to cust
1717
- `IGNORED_BRANCHES` - A comma seperated list of branches that should be ignored
1818
- `IGNORED_USERS` - A comma seperated list of users that should be ignored
1919
- `IGNORED_PAYLOADS` - A comma seperated list of webhook events that should be ignored
20+
- `IGNORED_CHECK_RUNS` - A comma separated list of check run names that should be ignored
2021
- `DEBUG_PASTE` - Set to `true` to enable debug embeds.
2122
- `EXECUTE_MERGE_QUEUE_BRANCHES` - Set to `true` to unignore merge queue related branches.
2223
- `HIDE_DETAILS_BODY` - Set to `true` to omit the body of details tags from messages. This will cause just summary to be shown in the message.

src/env.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface Env {
66
IGNORED_BRANCHES: string;
77
IGNORED_USERS: string;
88
IGNORED_PAYLOADS: string;
9+
IGNORED_CHECK_RUNS: string;
910

1011
GITHUB_WEBHOOK_SECRET: string;
1112

@@ -23,6 +24,7 @@ export class BoundEnv {
2324
private ignoredBranches: string[];
2425
private ignoredUsers: string[];
2526
private ignoredPayloads: string[];
27+
private ignoredCheckRuns: string[];
2628
readonly githubWebhookSecret: string;
2729
readonly debugPaste: boolean;
2830
readonly awaitErrors: boolean;
@@ -36,6 +38,7 @@ export class BoundEnv {
3638
this.ignoredBranches = env.IGNORED_BRANCHES?.split(",") || [];
3739
this.ignoredUsers = env.IGNORED_USERS?.split(",") || [];
3840
this.ignoredPayloads = env.IGNORED_PAYLOADS?.split(",") || [];
41+
this.ignoredCheckRuns = env.IGNORED_CHECK_RUNS?.split(",") || [];
3942
this.githubWebhookSecret = env.GITHUB_WEBHOOK_SECRET;
4043
this.debugPaste = env.DEBUG_PASTE == "true" || env.DEBUG_PASTE == "1";
4144
this.awaitErrors = env.AWAIT_ERRORS == "true" || env.AWAIT_ERRORS == "1";
@@ -71,6 +74,14 @@ export class BoundEnv {
7174
return this.ignoredPayloads.includes(payload);
7275
}
7376

77+
/**
78+
* @param {String} name
79+
* @return {boolean}
80+
*/
81+
isIgnoredCheckRun(name: string): boolean {
82+
return this.ignoredCheckRuns.includes(name);
83+
}
84+
7485
async buildDebugPaste(embed: any): Promise<string> {
7586
embed = JSON.stringify({
7687
"files": [

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,10 @@ function buildCheck(
826826
return null;
827827
}
828828

829+
if (env.isIgnoredCheckRun(check_run.name)) {
830+
return null;
831+
}
832+
829833
if (check_suite.pull_requests && check_suite.pull_requests.length > 0) {
830834
let pull = check_suite['pull_requests'][0];
831835
if (

wrangler.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ IGNORED_BRANCH_REGEX=""
99
IGNORED_BRANCHES=""
1010
IGNORED_USERS=""
1111
IGNORED_PAYLOADS=""
12+
IGNORED_CHECK_RUNS=""
1213
DEBUG_PASTE=false
1314
EXECUTE_MERGE_QUEUE_BRANCHES=false
1415

0 commit comments

Comments
 (0)