Skip to content
Merged
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
1 change: 1 addition & 0 deletions pkg/cli/compile_maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ engine: copilot
safe-outputs:
create-issue:
max: 1
noop: false
---

Test workflow that creates issues without expiration.
Expand Down
19 changes: 18 additions & 1 deletion pkg/workflow/maintenance_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,14 @@ type GenerateMaintenanceWorkflowOptions struct {
RepoSlug string
}

const defaultNoOpIssueExpirationHours = 24 * 30

func isNoOpReportAsIssueEnabled(reportAsIssue *string) bool {
return reportAsIssue == nil || !strings.EqualFold(strings.TrimSpace(*reportAsIssue), "false")
}

// GenerateMaintenanceWorkflow generates the agentics-maintenance.yml workflow
// if any workflows use the expires field for discussions or issues.
// if any workflows use expiring safe outputs or noop issue reporting.
// When opts.RepoConfig is non-nil and opts.RepoConfig.MaintenanceDisabled is true the
// maintenance workflow is deleted and the function returns immediately.
// opts.RepoSlug is the owner/repo slug used to determine the default branch for the push
Expand Down Expand Up @@ -343,6 +349,17 @@ func scanWorkflowsForExpires(workflowDataList []*WorkflowData) (bool, int) {
}
}
}
// Check for no-op runs issue expiration (runtime defaults to 30 days)
if workflowData.SafeOutputs.NoOp != nil {
if isNoOpReportAsIssueEnabled(workflowData.SafeOutputs.NoOp.ReportAsIssue) {
hasExpires = true
expires := defaultNoOpIssueExpirationHours
maintenanceLog.Printf("Workflow %s has no-op report-as-issue enabled, using %d-hour no-op issue expiration", workflowData.Name, expires)
if minExpires == 0 || expires < minExpires {
minExpires = expires
}
}
}
}

return hasExpires, minExpires
Expand Down
43 changes: 43 additions & 0 deletions pkg/workflow/maintenance_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,49 @@ func TestGenerateMaintenanceWorkflow_WithExpires(t *testing.T) {
expectWorkflowGenerated: true,
expectError: false,
},
{
name: "with noop report-as-issue default - should generate workflow",
workflowDataList: []*WorkflowData{
{
Name: "noop-default-workflow",
SafeOutputs: &SafeOutputsConfig{
NoOp: &NoOpConfig{},
},
},
},
expectWorkflowGenerated: true,
expectError: false,
},
{
name: "with noop report-as-issue false - should NOT generate workflow",
workflowDataList: []*WorkflowData{
{
Name: "noop-disabled-report-workflow",
SafeOutputs: &SafeOutputsConfig{
NoOp: &NoOpConfig{
ReportAsIssue: strPtr("false"),
},
},
},
},
expectWorkflowGenerated: false,
expectError: false,
},
{
name: "with noop report-as-issue true - should generate workflow",
workflowDataList: []*WorkflowData{
{
Name: "noop-explicit-report-workflow",
SafeOutputs: &SafeOutputsConfig{
NoOp: &NoOpConfig{
ReportAsIssue: strPtr("true"),
},
},
},
},
expectWorkflowGenerated: true,
expectError: false,
},
}

for _, tt := range tests {
Expand Down
Loading