forked from quarkusio/quarkus-github-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuarkusGitHubBotConfigFile.java
144 lines (93 loc) · 3.54 KB
/
QuarkusGitHubBotConfigFile.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package io.quarkus.bot.config;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class QuarkusGitHubBotConfigFile {
@JsonDeserialize(as = HashSet.class)
Set<Feature> features = new HashSet<>();
public TriageConfig triage = new TriageConfig();
public WorkflowRunAnalysisConfig workflowRunAnalysis = new WorkflowRunAnalysisConfig();
public Projects projects = new Projects();
public ProjectsClassic projectsClassic = new ProjectsClassic();
public Workflows workflows = new Workflows();
public static class TriageConfig {
public List<TriageRule> rules = new ArrayList<>();
public QE qe = new QE();
public Discussions discussions = new Discussions();
}
public static class TriageRule {
public String title;
public String body;
public String titleBody;
public String expression;
/**
* @deprecated use files instead
*/
@JsonDeserialize(as = TreeSet.class)
@Deprecated(forRemoval = true)
public Set<String> directories = new TreeSet<>();
@JsonDeserialize(as = TreeSet.class)
public Set<String> files = new TreeSet<>();
@JsonDeserialize(as = TreeSet.class)
public Set<String> labels = new TreeSet<>();
@JsonDeserialize(as = TreeSet.class)
public Set<String> notify = new TreeSet<>();
public String comment;
public boolean notifyInPullRequest;
public boolean allowSecondPass = false;
}
public static class QE {
@JsonDeserialize(as = TreeSet.class)
public Set<String> notify = new TreeSet<>();
}
public static class Discussions {
/**
* This is a list of numeric ids.
* <p>
* Note that it's a bit tricky to get this id as it's not present in the GraphQL API. You have to generate an event and
* have a look at what is in the payload.
*/
@JsonDeserialize(as = TreeSet.class)
public Set<Long> monitoredCategories = new TreeSet<>();
public boolean logCategories = false;
}
public static class WorkflowRunAnalysisConfig {
@JsonDeserialize(as = HashSet.class)
public Set<String> workflows = new HashSet<>();
}
public static class Workflows {
public List<WorkflowApprovalRule> rules = new ArrayList<>();
}
public static class Projects {
public List<ProjectTriageRule> rules = new ArrayList<>();
}
public static class ProjectsClassic {
public List<ProjectTriageRule> rules = new ArrayList<>();
}
public static class ProjectTriageRule {
@JsonDeserialize(as = TreeSet.class)
public Set<String> labels = new TreeSet<>();
public Integer project;
public boolean issues = false;
public boolean pullRequests = false;
public String status;
}
public static class WorkflowApprovalRule {
public WorkflowApprovalCondition allow;
public WorkflowApprovalCondition unless;
}
public static class WorkflowApprovalCondition {
@JsonDeserialize(as = TreeSet.class)
public Set<String> files = new TreeSet<>();
public UserRule users;
}
public static class UserRule {
public Integer minContributions;
}
boolean isFeatureEnabled(Feature feature) {
return features.contains(Feature.ALL) || features.contains(feature);
}
}