runner: drop needs: from single-job payload so multi-stage jobs run
4b94605 · gmorell · 2026-07-02 04:09
Message
{commit_body(@commit)}
Files changed
modified
lib/git_gud/workflows/runner_payload.ex
+11
−1
@@ -23,11 +23,21 @@ defmodule GitGud.Workflows.RunnerPayload do
| 23 | 23 | def encode(%WorkflowJob{} = job) do |
| 24 | 24 | run = GitGud.Repo.get!(WorkflowRun, job.workflow_run_id) |
| 25 | 25 | |
| 26 | + # Drop `needs:` from the single-job payload. The referenced upstream | |
| 27 | + # jobs aren't included here, so act can't resolve them — it warns | |
| 28 | + # "'runs-on' key not defined in ci/<need>" and the implicit | |
| 29 | + # `if: success()` evaluates false, silently skipping the job. That | |
| 30 | + # broke every multi-stage (test -> image) workflow. The dependency is | |
| 31 | + # already honoured out-of-band: the forge only dispatches a job once | |
| 32 | + # its needs are satisfied (Workflows.resolve_dependents), and upstream | |
| 33 | + # results/outputs reach the job via the Task `needs` field. | |
| 34 | + definition = Map.drop(job.definition, ["needs", :needs]) | |
| 35 | + | |
| 26 | 36 | workflow_doc = %{ |
| 27 | 37 | "name" => run.workflow_name || run.workflow_path, |
| 28 | 38 | "on" => "push", |
| 29 | 39 | "jobs" => %{ |
| 30 | − job.job_id => job.definition | |
| 40 | + job.job_id => definition | |
| 31 | 41 | } |
| 32 | 42 | } |
| 33 | 43 |
Parents: 20e646b