(includeIssues bool, includePullRequests bool, includeDiscussions bool)
| 138 | } |
| 139 | |
| 140 | func buildDispatchSourceEventCondition(includeIssues bool, includePullRequests bool, includeDiscussions bool) ConditionNode { |
| 141 | eventExpr := BuildPropertyAccess("fromJSON(github.event.inputs.aw_context || '{}').event_type") |
| 142 | var terms []ConditionNode |
| 143 | |
| 144 | if includeIssues { |
| 145 | terms = append(terms, BuildEquals(eventExpr, BuildStringLiteral("issues"))) |
| 146 | terms = append(terms, BuildEquals(eventExpr, BuildStringLiteral("issue_comment"))) |
| 147 | } |
| 148 | if includePullRequests { |
| 149 | terms = append(terms, BuildEquals(eventExpr, BuildStringLiteral("pull_request_review_comment"))) |
| 150 | terms = append(terms, BuildEquals(eventExpr, BuildStringLiteral("pull_request"))) |
| 151 | } |
| 152 | if includeDiscussions { |
| 153 | terms = append(terms, BuildEquals(eventExpr, BuildStringLiteral("discussion"))) |
| 154 | terms = append(terms, BuildEquals(eventExpr, BuildStringLiteral("discussion_comment"))) |
| 155 | } |
| 156 | if len(terms) == 0 { |
| 157 | return BuildBooleanLiteral(false) |
| 158 | } |
| 159 | return BuildDisjunction(false, terms...) |
| 160 | } |
| 161 | |
| 162 | // buildCommentAuthorAssociationCondition returns a ConditionNode that passes for non-comment |
| 163 | // events and for comment events whose author is an OWNER, MEMBER, or COLLABORATOR. |
no test coverage detected