mirror of
https://github.com/actions/runner.git
synced 2026-07-03 19:19:24 +08:00
A step's parameters (`with:`, `env:`, `if:`, ...) arrive at the
runner as TemplateToken trees with `${{ ... }}` expressions still
embedded. The DAP execution view (the source the debugger serves)
must reflect those parameters as the user authored them — pre
evaluation, with expressions intact — so that what the user sees in
their debugger matches their workflow file.
This commit adds a YamlDotNet `IObjectWriter` adapter so the
runner's existing `TemplateWriter.Write` can drive a YamlDotNet
`Emitter`. With the adapter, serializing a TemplateToken tree to
YAML is a single call. The adapter walks BasicExpressionTokens via
`ToDisplayString()` instead of `ToString()` so that composite
scalars like `${{ runner.os }}-primes` round-trip to their authored
form (the parser otherwise rewrites them as
`format('{0}-primes', runner.os)`).
This piece is independent of the renderer (#PR1b) and view
container (#PR1c) and stacks on those PRs only for branch ordering.
The translator (#PR1e, next) is its only consumer.
This is part 4 of 5 splitting the previously-monolithic foundation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>