runUpgradeForOrg runs the upgrade command across all repositories in an organization that have agentic workflow files. Without --create-pull-request or --create-issue it prints a dry-run preview; with --create-pull-request it checks out each repository, runs the upgrade, and opens a pull request; wi
(ctx context.Context, org string, repoGlobs []string, opts upgradeOptions, createPR bool, createIssue bool, verbose bool)
| 34 | // organization discovery, rate-limit handling, graceful cancellation, result |
| 35 | // sorting, and per-repo error recovery. |
| 36 | func runUpgradeForOrg(ctx context.Context, org string, repoGlobs []string, opts upgradeOptions, createPR bool, createIssue bool, verbose bool) error { |
| 37 | upgradeOrgLog.Printf("Running org upgrade: org=%s, globs=%d, createPR=%v, createIssue=%v", org, len(repoGlobs), createPR, createIssue) |
| 38 | return runCommandForOrg(ctx, org, repoGlobs, orgRunCallbacks{ |
| 39 | AutoYes: opts.yes, |
| 40 | SearchFn: searchOrgLockWorkflowReposFn, |
| 41 | ScanFn: func(ctx context.Context, repo string, v bool) (orgRepoPreview, bool, error) { |
| 42 | return scanUpgradeRepoFn(ctx, repo, v) |
| 43 | }, |
| 44 | ReportFn: renderOrgUpgradeReport, |
| 45 | ApplyFn: func(ctx context.Context, preview orgRepoPreview, v bool) error { |
| 46 | return runUpgradeForTargetRepoFn(ctx, preview.Repo, opts, v) |
| 47 | }, |
| 48 | IssueFn: func(ctx context.Context, preview orgRepoPreview, v bool) error { |
| 49 | return createIssueForUpgradeOrgRepoFn(ctx, preview.Repo, v) |
| 50 | }, |
| 51 | DiscoveringMsg: "Discovering repositories in " + org + " with agentic workflows...", |
| 52 | NoReposMsg: "No repositories found with agentic workflows", |
| 53 | ScanLabel: "Inspecting", |
| 54 | ApplyLabel: "Upgrading", |
| 55 | IssueLabel: "Creating issue in", |
| 56 | NoResultsMsg: "No repositories with agentic workflows found", |
| 57 | NoResultsStopMsg: "No repositories found before processing stopped", |
| 58 | AllFailApplyMsg: "failed to upgrade any repository", |
| 59 | AllFailIssueMsg: "failed to create issues in any repository", |
| 60 | }, createPR, createIssue, verbose) |
| 61 | } |
| 62 | |
| 63 | // scanUpgradeRepo shallow-clones repo, counts agentic workflow files, and |
| 64 | // extracts the current compiler version from the first lock file it finds. |