How to combine multiple 'uses' in github actions?

I find myself repeating these three lines.

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - uses: aahnik/setup-pyproject@main

How can I combine these three ?

In the composite action, “uses” is not allowed…

You can’t. A step can only run one action or task at a time. So you have to list them out separately.

3 Likes

If GitHub Actions supports the fully YAML specification, try Anchors:

https://medium.com/@kinghuang/docker-compose-anchors-aliases-extensions-a1e4105d70bd

I suppose you could specify the list once at the top and then recall it in every job in the same file

Right now the GitHub Actions YAML doesn’t support anchors.