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)
| 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. |
| 361 | func 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 |