-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathupdate_pull_request.go
More file actions
36 lines (28 loc) · 1.46 KB
/
update_pull_request.go
File metadata and controls
36 lines (28 loc) · 1.46 KB
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
package workflow
import (
"github.com/githubnext/gh-aw/pkg/logger"
)
var updatePullRequestLog = logger.New("workflow:update_pull_request")
// UpdatePullRequestsConfig holds configuration for updating GitHub pull requests from agent output
type UpdatePullRequestsConfig struct {
UpdateEntityConfig `yaml:",inline"`
Title *bool `yaml:"title,omitempty"` // Allow updating PR title - defaults to true, set to false to disable
Body *bool `yaml:"body,omitempty"` // Allow updating PR body - defaults to true, set to false to disable
}
// parseUpdatePullRequestsConfig handles update-pull-request configuration
func (c *Compiler) parseUpdatePullRequestsConfig(outputMap map[string]any) *UpdatePullRequestsConfig {
updatePullRequestLog.Print("Parsing update pull request configuration")
// Parse base configuration using helper
baseConfig, configMap := c.parseUpdateEntityBase(outputMap, UpdateEntityPullRequest, "update-pull-request", updatePullRequestLog)
if baseConfig == nil {
return nil
}
// Create UpdatePullRequestsConfig with base fields
updatePullRequestsConfig := &UpdatePullRequestsConfig{
UpdateEntityConfig: *baseConfig,
}
// Parse PR-specific fields using bool value mode (defaults to true if nil)
updatePullRequestsConfig.Title = parseUpdateEntityBoolField(configMap, "title", FieldParsingBoolValue)
updatePullRequestsConfig.Body = parseUpdateEntityBoolField(configMap, "body", FieldParsingBoolValue)
return updatePullRequestsConfig
}