A workflow defines an anchor on a defaults map and merges it into a step map with a merge key, while the step map also sets its own timeout-minutes value. When analysing the merged result, what timeout-minutes value applies to the step?
defaults: &base
timeout-minutes: 10
shell: bash
steps:
- name: Build
<<: *base
timeout-minutes: 30
run: make build- A10, because the merge key applies the anchored map last and its timeout-minutes overrides any value written directly on the step map during YAML resolution.
- B40, because the merge key adds the anchored timeout-minutes to the value declared on the step map, producing a combined numeric total when the alias is expanded.
- C30, because keys written directly on the mapping take precedence over keys supplied by the merge key, so the step value overrides the anchored default during resolution. Correct
- Dan error, because a merge key cannot reference a key such as timeout-minutes that the receiving step map already defines, so the parser rejects the duplicate mapping.
Why A is wrong: Tempting because the anchor is listed first, but a merge key only supplies defaults for keys the node does not already define, so the explicit 30 is kept and 10 never wins.
Why B is wrong: Tempting because both values are numeric, but merge keys never perform arithmetic on duplicate keys, they resolve to one value, so summing the two numbers is not how resolution works.
Why C is correct: A merge key fills in only the keys not already present on the node, so the directly written timeout-minutes of 30 takes precedence over the merged default of 10 from the anchor.
Why D is wrong: Tempting because duplicate plain keys are rejected, but a merge key is designed exactly for this case and silently defers to the local value, so no parse error is raised here.