MCPcopy Create free account
hub / github.com/github/gh-aw / buildDispatchSourceEventCondition

Function buildDispatchSourceEventCondition

pkg/workflow/expression_builder.go:140–160  ·  view source on GitHub ↗
(includeIssues bool, includePullRequests bool, includeDiscussions bool)

Source from the content-addressed store, hash-verified

138}
139
140func 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.

Callers 1

Calls 5

BuildPropertyAccessFunction · 0.85
BuildEqualsFunction · 0.85
BuildStringLiteralFunction · 0.85
BuildBooleanLiteralFunction · 0.85
BuildDisjunctionFunction · 0.85

Tested by

no test coverage detected