Support for YAML anchors

Thanks for promoting my attempt at solving the problem @laughedelic ! I would love some help with the action if anyone has time.

I would love an “automatic” mode which finds all the unprocessed workflows and automatically updates (either directly or via pull requests) the processed workflow output. See Add a "find .yaml workflows with includes and expand" mode · Issue #6 · mithro/actions-includes · GitHub

Also open to feature requests and suggestions.

1 Like

Inspired by mithro’s Python solution, here’s an incredibly stupid, simple solution for the JS ecosystem:

All it does is expands the YAML references/anchors. I didn’t want to introduce Python as a dependency for my team’s workflows for certain projects nor did I want to introduce a custom syntax. Once GitHub supports YAML anchors, you’d be able to just move the “source” files without needing to remove custom syntax.

I wanted to put build and test in separate jobs and both use the same matrix, so I wanted to share the matrix with a YAML anchor. It would be really nice to have this.

:pray: it would be really helpful to have them.

I would love to be able to reuse steps like this for example:

x-pre-steps:
  - name: Foo
    run: echo "foo"
  - name: Bar
    run: echo "bar"

jobs:
  baz:
    steps:
      <<: *x-pre-steps
      - run: echo "baz"
  random:
    steps:
      <<: *x-pre-steps
      - run: echo "random"
1 Like