Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .github/workflows/agent-performance-analyzer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions .github/workflows/agent-persona-explorer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions .github/workflows/daily-issues-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions .github/workflows/daily-observability-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions .github/workflows/metrics-collector.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/workflow/compiler_orchestrator_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (c *Compiler) extractAdditionalConfigurations(
workflowData.RepoMemoryConfig = repoMemoryConfig

// Extract and process safe-inputs and safe-outputs
workflowData.Command, workflowData.CommandEvents = c.extractCommandConfig(frontmatter)
workflowData.Command, workflowData.CommandEvents = c.extractCommandConfig(frontmatter, workflowData)
workflowData.Jobs = c.extractJobsFromFrontmatter(frontmatter)
workflowData.Roles = c.extractRoles(frontmatter)
workflowData.Bots = c.extractBots(frontmatter)
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/compiler_safe_outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (c *Compiler) parseOnSection(frontmatter map[string]any, workflowData *Work
// Post-process YAML to ensure cron expressions are quoted
yamlStr = parser.QuoteCronExpressions(yamlStr)
// Apply comment processing to filter fields (draft, forks, names)
yamlStr = c.commentOutProcessedFieldsInOnSection(yamlStr, frontmatter)
yamlStr = c.commentOutProcessedFieldsInOnSection(yamlStr, frontmatter, workflowData)
// Add zizmor ignore comment if workflow_run trigger is present
yamlStr = c.addZizmorIgnoreForWorkflowRun(yamlStr)
// Keep "on" quoted as it's a YAML boolean keyword
Expand Down
5 changes: 5 additions & 0 deletions pkg/workflow/data/action_pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"version": "v5",
"sha": "93cb6efe18208431cddfb8368fd83d5badbf9bfd"
},
"actions/checkout@v6": {
"repo": "actions/checkout",
"version": "v6",
"sha": "8e8c483db84b4bee98b60c0593521ed34d9990e8"
},
"actions/checkout@v6.0.2": {
"repo": "actions/checkout",
"version": "v6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions pkg/workflow/error_message_quality_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestErrorMessageQuality(t *testing.T) {
"manual-approval": 123, // Wrong type
},
}
_, err := c.extractManualApprovalFromOn(frontmatter)
_, err := c.extractManualApprovalFromOn(frontmatter, nil)
return err
},
shouldContain: []string{
Expand All @@ -45,7 +45,7 @@ func TestErrorMessageQuality(t *testing.T) {
frontmatter := map[string]any{
"on": []string{"invalid"}, // Wrong type
}
_, err := c.extractManualApprovalFromOn(frontmatter)
_, err := c.extractManualApprovalFromOn(frontmatter, nil)
return err
},
shouldContain: []string{
Expand Down
28 changes: 24 additions & 4 deletions pkg/workflow/frontmatter_extraction_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,22 @@ func (c *Compiler) extractTopLevelYAMLSection(frontmatter map[string]any, key st
// commentOutProcessedFieldsInOnSection comments out draft, fork, forks, names, manual-approval, stop-after, skip-if-match, skip-if-no-match, reaction, and lock-for-agent fields in the on section
// These fields are processed separately and should be commented for documentation
// Exception: names fields in sections with __gh_aw_native_label_filter__ marker in frontmatter are NOT commented out
func (c *Compiler) commentOutProcessedFieldsInOnSection(yamlStr string, frontmatter map[string]any) string {
func (c *Compiler) commentOutProcessedFieldsInOnSection(yamlStr string, frontmatter map[string]any, workflowData ...*WorkflowData) string {
frontmatterLog.Print("Processing 'on' section to comment out processed fields")

// Use cached On field from ParsedFrontmatter if available (when workflowData is provided)
var onValue any
var exists bool
if len(workflowData) > 0 && workflowData[0] != nil && workflowData[0].ParsedFrontmatter != nil && workflowData[0].ParsedFrontmatter.On != nil {
onValue = workflowData[0].ParsedFrontmatter.On
exists = true
} else {
onValue, exists = frontmatter["on"]
}

// Check frontmatter for native label filter markers
nativeLabelFilterSections := make(map[string]bool)
if onValue, exists := frontmatter["on"]; exists {
if exists {
if onMap, ok := onValue.(map[string]any); ok {
for _, sectionKey := range []string{"issues", "pull_request", "discussion", "issue_comment"} {
if sectionValue, hasSec := onMap[sectionKey]; hasSec {
Expand Down Expand Up @@ -507,10 +517,20 @@ func (c *Compiler) extractExpressionFromIfString(ifString string) string {
}

// extractCommandConfig extracts command configuration from frontmatter including name and events
func (c *Compiler) extractCommandConfig(frontmatter map[string]any) (commandNames []string, commandEvents []string) {
func (c *Compiler) extractCommandConfig(frontmatter map[string]any, workflowData ...*WorkflowData) (commandNames []string, commandEvents []string) {
// Use cached On field from ParsedFrontmatter if available (when workflowData is provided)
var onValue any
var exists bool
if len(workflowData) > 0 && workflowData[0] != nil && workflowData[0].ParsedFrontmatter != nil && workflowData[0].ParsedFrontmatter.On != nil {
onValue = workflowData[0].ParsedFrontmatter.On
exists = true
} else {
onValue, exists = frontmatter["on"]
}

// Check new format: on.slash_command or on.slash_command.name (preferred)
// Also check legacy format: on.command or on.command.name (deprecated)
if onValue, exists := frontmatter["on"]; exists {
if exists {
if onMap, ok := onValue.(map[string]any); ok {
var commandValue any
var hasCommand bool
Expand Down
17 changes: 13 additions & 4 deletions pkg/workflow/manual_approval.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ import (
var manualApprovalLog = logger.New("workflow:manual_approval")

// extractManualApprovalFromOn extracts the manual-approval value from the on: section
func (c *Compiler) extractManualApprovalFromOn(frontmatter map[string]any) (string, error) {
onSection, exists := frontmatter["on"]
func (c *Compiler) extractManualApprovalFromOn(frontmatter map[string]any, workflowData *WorkflowData) (string, error) {
// Use cached On field from ParsedFrontmatter if available, otherwise fall back to map access
var onSection any
var exists bool
if workflowData != nil && workflowData.ParsedFrontmatter != nil && workflowData.ParsedFrontmatter.On != nil {
onSection = workflowData.ParsedFrontmatter.On
exists = true
} else {
onSection, exists = frontmatter["on"]
}

if !exists {
manualApprovalLog.Print("No on: section found in frontmatter")
return "", nil
Expand Down Expand Up @@ -42,8 +51,8 @@ func (c *Compiler) extractManualApprovalFromOn(frontmatter map[string]any) (stri
func (c *Compiler) processManualApprovalConfiguration(frontmatter map[string]any, workflowData *WorkflowData) error {
manualApprovalLog.Print("Processing manual-approval configuration")

// Extract manual-approval from the on: section
manualApproval, err := c.extractManualApprovalFromOn(frontmatter)
// Extract manual-approval from the on: section (uses cached ParsedFrontmatter.On if available)
manualApproval, err := c.extractManualApprovalFromOn(frontmatter, workflowData)
if err != nil {
manualApprovalLog.Printf("Failed to extract manual-approval: %v", err)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/manual_approval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestExtractManualApprovalFromOn(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Compiler{}
got, err := c.extractManualApprovalFromOn(tt.frontmatter)
got, err := c.extractManualApprovalFromOn(tt.frontmatter, nil)
if (err != nil) != tt.wantErr {
t.Errorf("extractManualApprovalFromOn() error = %v, wantErr %v", err, tt.wantErr)
return
Expand Down
Loading