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

Function runPostProcessingForDirectory

pkg/cli/compile_pipeline.go:546–611  ·  view source on GitHub ↗

runPostProcessingForDirectory runs post-processing for directory compilation

(
	ctx context.Context,
	compiler *workflow.Compiler,
	workflowDataList []*workflow.WorkflowData,
	config CompileConfig,
	workflowsDir string,
	gitRoot string,
	successCount int,
	errorCount int,
)

Source from the content-addressed store, hash-verified

544
545// runPostProcessingForDirectory runs post-processing for directory compilation
546func runPostProcessingForDirectory(
547 ctx context.Context,
548 compiler *workflow.Compiler,
549 workflowDataList []*workflow.WorkflowData,
550 config CompileConfig,
551 workflowsDir string,
552 gitRoot string,
553 successCount int,
554 errorCount int,
555) error {
556 // Get action cache
557 actionCache := compiler.GetSharedActionCache()
558
559 // Update .gitattributes (errors are non-fatal)
560 _ = updateGitAttributes(successCount, actionCache, config.Verbose)
561
562 // Generate Dependabot manifests if requested
563 if config.Dependabot && !config.NoEmit {
564 absWorkflowDir := getAbsoluteWorkflowDir(workflowsDir, gitRoot)
565 if err := generateDependabotManifestsWrapper(compiler, workflowDataList, absWorkflowDir, config.ForceOverwrite, config.Strict); err != nil {
566 if config.Strict {
567 return err
568 }
569 }
570 }
571
572 // Reconcile compiler-managed Dependabot ignore entries for compiler-emitted action refs.
573 if config.Dependabot && !config.NoEmit {
574 if err := compiler.ReconcileManagedDependabotIgnoresInRepo(gitRoot); err != nil {
575 if config.Strict {
576 return err
577 }
578 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to reconcile compiler-managed Dependabot ignore entries: %v", err)))
579 }
580 }
581
582 // Generate maintenance workflow if needed.
583 // Skip maintenance workflow generation when using custom --dir option.
584 // Keep invoking generators for empty workflowDataList so stale generated files are cleaned up.
585 if !config.NoEmit && config.WorkflowDir == "" {
586 absWorkflowDir := getAbsoluteWorkflowDir(workflowsDir, gitRoot)
587 if err := generateMaintenanceWorkflowWrapper(ctx, compiler, workflowDataList, absWorkflowDir, gitRoot, config.Verbose, config.Strict); err != nil {
588 if config.Strict {
589 return err
590 }
591 }
592 if err := generateCentralSlashCommandWorkflowWrapper(ctx, workflowDataList, absWorkflowDir, gitRoot, config.Strict); err != nil {
593 if config.Strict {
594 return err
595 }
596 }
597 }
598
599 // Prune stale gh-aw-actions entries before saving
600 pruneStaleActionCacheEntries(compiler, actionCache)
601
602 // Prune orphaned entries — entries for action versions no longer referenced
603 // by any workflow in the directory (e.g. old pins left after a version bump).

Callers 1

Tested by

no test coverage detected