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

Function buildSafeOutputsSections

pkg/workflow/unified_prompt_step.go:532–756  ·  view source on GitHub ↗

buildSafeOutputsSections returns the PromptSections that form the block. The block contains: 1. An inline opening tag with a compact Tools list (dynamic, depends on which tools are enabled). Any ${{ }} expressions in max: values are extracted to GH_AW_* env vars and replaced with

(safeOutputs *SafeOutputsConfig)

Source from the content-addressed store, hash-verified

530// The static intro (gh CLI warning, temporary ID rules, noop note) lives in
531// actions/setup/md/safe_outputs_prompt.md and is included by the caller before these sections.
532func buildSafeOutputsSections(safeOutputs *SafeOutputsConfig) []PromptSection {
533 if safeOutputs == nil {
534 return nil
535 }
536
537 safeOutputsPromptLog.Print("Building safe outputs sections")
538
539 // Build compact list of enabled tool names, annotated with max budget when > 1.
540 var tools []string
541 if safeOutputs.AddComments != nil {
542 tools = append(tools, toolWithMaxBudget("add_comment", safeOutputs.AddComments.Max))
543 }
544 if safeOutputs.CreateIssues != nil {
545 tools = append(tools, toolWithMaxBudget("create_issue", safeOutputs.CreateIssues.Max))
546 }
547 if safeOutputs.CloseIssues != nil {
548 tools = append(tools, toolWithMaxBudget("close_issue", safeOutputs.CloseIssues.Max))
549 }
550 if safeOutputs.UpdateIssues != nil {
551 tools = append(tools, toolWithMaxBudget("update_issue", safeOutputs.UpdateIssues.Max))
552 }
553 if safeOutputs.CreateDiscussions != nil {
554 tools = append(tools, toolWithMaxBudget("create_discussion", safeOutputs.CreateDiscussions.Max))
555 }
556 if safeOutputs.UpdateDiscussions != nil {
557 tools = append(tools, toolWithMaxBudget("update_discussion", safeOutputs.UpdateDiscussions.Max))
558 }
559 if safeOutputs.CloseDiscussions != nil {
560 tools = append(tools, toolWithMaxBudget("close_discussion", safeOutputs.CloseDiscussions.Max))
561 }
562 if safeOutputs.CreateAgentSessions != nil {
563 tools = append(tools, toolWithMaxBudget("create_agent_session", safeOutputs.CreateAgentSessions.Max))
564 }
565 if safeOutputs.CreatePullRequests != nil {
566 tools = append(tools, toolWithMaxBudget("create_pull_request", safeOutputs.CreatePullRequests.Max))
567 }
568 if safeOutputs.ClosePullRequests != nil {
569 tools = append(tools, toolWithMaxBudget("close_pull_request", safeOutputs.ClosePullRequests.Max))
570 }
571 if safeOutputs.UpdatePullRequests != nil {
572 tools = append(tools, toolWithMaxBudget("update_pull_request", safeOutputs.UpdatePullRequests.Max))
573 }
574 if safeOutputs.MarkPullRequestAsReadyForReview != nil {
575 tools = append(tools, toolWithMaxBudget("mark_pull_request_as_ready_for_review", safeOutputs.MarkPullRequestAsReadyForReview.Max))
576 }
577 if safeOutputs.CreatePullRequestReviewComments != nil {
578 tools = append(tools, toolWithMaxBudget("create_pull_request_review_comment", safeOutputs.CreatePullRequestReviewComments.Max))
579 }
580 if safeOutputs.SubmitPullRequestReview != nil {
581 tools = append(tools, toolWithMaxBudget("submit_pull_request_review", safeOutputs.SubmitPullRequestReview.Max))
582 }
583 if safeOutputs.ReplyToPullRequestReviewComment != nil {
584 tools = append(tools, toolWithMaxBudget("reply_to_pull_request_review_comment", safeOutputs.ReplyToPullRequestReviewComment.Max))
585 }
586 if safeOutputs.ResolvePullRequestReviewThread != nil {
587 tools = append(tools, toolWithMaxBudget("resolve_pull_request_review_thread", safeOutputs.ResolvePullRequestReviewThread.Max))
588 }
589 if safeOutputs.AddLabels != nil {

Calls 9

ExtractExpressionsMethod · 0.95
SortedKeysFunction · 0.92
toolWithMaxBudgetFunction · 0.85
NewExpressionExtractorFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45
StringMethod · 0.45