@@ -96,6 +96,11 @@ type Result struct { |
| 96 | 96 | // looked up via ExternalID) for the workflow's jobs. Order |
| 97 | 97 | // matches Workflow.Jobs declaration order. |
| 98 | 98 | CheckRunIDs []int64 |
| 99 | + // Skipped is true when the workflow was matched but not enqueued |
| 100 | + // because the operator disabled it via the workflow_disabled |
| 101 | + // table. RunID/RunIndex/CheckRunIDs are zero in this case; the |
| 102 | + // caller's only sensible response is to log + move on. |
| 103 | + Skipped bool |
| 99 | 104 | } |
| 100 | 105 | |
| 101 | 106 | // Enqueue persists a matched workflow as a queued run with all its |
@@ -112,6 +117,20 @@ func Enqueue(ctx context.Context, deps Deps, p EnqueueParams) (Result, error) { |
| 112 | 117 | if err := validateParams(&p); err != nil { |
| 113 | 118 | return Result{}, err |
| 114 | 119 | } |
| 120 | + // Honour the per-workflow disable flag (§13 REST). A disabled |
| 121 | + // workflow's events get matched and reach here, then bail out |
| 122 | + // before any run/jobs/check_runs rows are written. Re-enabling |
| 123 | + // (DELETE the row) resumes triggering as normal. |
| 124 | + disabled, err := actionsdb.New().IsWorkflowDisabled(ctx, deps.Pool, actionsdb.IsWorkflowDisabledParams{ |
| 125 | + RepoID: p.RepoID, |
| 126 | + WorkflowFile: p.WorkflowFile, |
| 127 | + }) |
| 128 | + if err != nil { |
| 129 | + return Result{}, fmt.Errorf("trigger: check disabled: %w", err) |
| 130 | + } |
| 131 | + if disabled { |
| 132 | + return Result{Skipped: true}, nil |
| 133 | + } |
| 115 | 134 | concurrencyResolution, err := concurrency.Resolve(concurrency.ResolveInput{ |
| 116 | 135 | Workflow: p.Workflow, |
| 117 | 136 | EventPayload: p.EventPayload, |