(ctx context.Context, cfg auditRunConfig)
| 529 | } |
| 530 | |
| 531 | func fetchAuditRunWithCache(ctx context.Context, cfg auditRunConfig) (WorkflowRun, bool, bool, error) { |
| 532 | hasLocalCache := fileutil.DirExists(cfg.outputDir) && !fileutil.IsDirEmpty(cfg.outputDir) |
| 533 | run, err := fetchWorkflowRunMetadata(ctx, cfg.runID, cfg.owner, cfg.repo, cfg.hostname, cfg.verbose) |
| 534 | if err == nil { |
| 535 | return run, hasLocalCache, false, nil |
| 536 | } |
| 537 | if !isPermissionError(err) { |
| 538 | return WorkflowRun{}, false, false, err |
| 539 | } |
| 540 | if !hasLocalCache { |
| 541 | return WorkflowRun{}, false, false, cacheRecoveryError( |
| 542 | "GitHub API access denied and no local cache found.", cfg.runID, cfg.outputDir, err, |
| 543 | ) |
| 544 | } |
| 545 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage("GitHub API access denied, but found locally cached artifacts. Processing cached data...")) |
| 546 | return run, hasLocalCache, true, nil |
| 547 | } |
| 548 | |
| 549 | func downloadAuditArtifactsIfNeeded(ctx context.Context, cfg auditRunConfig, run WorkflowRun, hasLocalCache bool) (bool, error) { |
| 550 | if cfg.verbose { |
no test coverage detected