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

Function allCopilotWorkflowsUseOrgBilling

pkg/workflow/maintenance_workflow.go:361–378  ·  view source on GitHub ↗

allCopilotWorkflowsUseOrgBilling reports whether all Copilot-engine workflows in the list have copilot-requests: write set. This indicates org billing mode, where the GITHUB_TOKEN is used for Copilot authentication and the COPILOT_GITHUB_TOKEN secret is not required. Returns false if no Copilot work

(workflowDataList []*WorkflowData)

Source from the content-addressed store, hash-verified

359// Returns false if no Copilot workflows are found (billing mode is indeterminate)
360// or if any Copilot workflow does not have copilot-requests: write set.
361func allCopilotWorkflowsUseOrgBilling(workflowDataList []*WorkflowData) bool {
362 copilotCount := 0
363 for _, data := range workflowDataList {
364 if data == nil {
365 continue
366 }
367 engineID := ResolveEngineID(data)
368 // Default engine (empty string) is Copilot, as is an explicit "copilot" ID.
369 if engineID != "" && engineID != string(constants.CopilotEngine) {
370 continue
371 }
372 copilotCount++
373 if !hasCopilotRequestsWritePermission(data) {
374 return false
375 }
376 }
377 return copilotCount > 0
378}
379
380// scanWorkflowsForExpires checks all workflow data for expires fields and returns
381// whether any expires fields are set, the minimum expires value in hours, and the

Calls 2

ResolveEngineIDFunction · 0.85

Tested by 1