package workflow import ( "context" "fmt" ) // notify posts a one-way notice on a forge-backed task's issue. The operator // alert for the task waiting on an operator is raised by the State Store when the // task parks. func notify(ctx context.Context, tc *TaskContext, kind string) { if tc.Task.IsForgeBacked() { if _, err := tc.Forge.Comment(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, deliveryNotice(tc, kind)); err != nil { tc.Log.WarnContext(ctx, "delivery notice not posted", "kind", kind, "issue", tc.Task.IssueNumber, "err", err) } } } // deliveryNotice is the body of the one-way notice notify posts on a // forge-backed task's issue. func deliveryNotice(tc *TaskContext, kind string) string { subject := "archie finished a run that needs attention" if kind == "approval" { subject = "archie's PRD is ready -- awaiting your go/no-go" } return fmt.Sprintf("**%s.**\n\n%s\n\n_Decide in chat or on the dashboard._", subject, tc.Task.Plan) }