An approval, ask or park can be resolved by an operator, a rule, a classifier or automatically, so the vocabulary stops naming a person: - step type human.approve -> workflow.approve - park class needs_human -> needs_decision (ParkNeedsDecision) - event kinds human_* -> operator_* - alert kind task.needs_human -> task.needs_decision - status grouping "needs you" -> "needs attention" 0061 rewrites the stored values, including the approval step type in the workflow-definitions resource and each task's pinned definition, with the digest recomputed so resumed tasks still match.
29 lines
972 B
Go
29 lines
972 B
Go
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.Warn("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)
|
|
}
|