Reusable workflow expansion is a capability that will allow Forgejo to schedule every job of a reusable workflow as a separate job, allowing the use of multiple runners and clear independent logging. This is a multi-PR implementation effort, project work tracking link: https://codeberg.org/forgejo/forgejo/issues/9768#issuecomment-8828016
This PR extends reusable workflow expansion to support accessing the outputs of a reusable workflow. Four changes are involved:
- Centralizing a duplicated `rewriteSubExpression` function between the jobparser and the runner.
- Creating an expression mutator which allows for transformations of expressions by their abstract syntax tree.
- Transforming the outputs in `on.workflow_call.outputs`, which are in the form of `jobs.some-job.outputs`, into `needs[format("{0}.{1}", parent-job-id, job-id)].outputs....` on the parent job. This moves evaluation of the outputs into the placeholder job that was previously created in #1215 to support dependencies between jobs.
- Addition of a utility function `EvaluateWorkflowCallOutputs` which Forgejo can use to evaluate the outputs, as the placeholder job is never sent to a runner to be executed.
- Corrected an earlier persistent misuse of "callee" to refer to "caller".
In addition to test automation present here, this change has been manually tested on an [experimental Forgejo branch](https://codeberg.org/mfenniak/forgejo/pulls/3).
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
- [PR](https://code.forgejo.org/forgejo/runner/pulls/1216): <!--number 1216 --><!--line 0 --><!--description ZmVhdChqb2JwYXJzZXIpOiBhbGxvdyBhY2Nlc3MgdG8gdGhlIG91dHB1dHMgb2YgYSByZXVzYWJsZSB3b3JrZmxvdw==-->feat(jobparser): allow access to the outputs of a reusable workflow<!--description-->
<!--end release-notes-assistant-->
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1216
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>