Using actions from actions

I’m trying to organize a large list of similar workflows. I decided to move the common code for all workflows into local actions.

My code looks like this:

workflow:

      - name: Build
        uses: ./.github/actions/build
        with:
          param1: something
          param2: else

action (in ./gitbhu/actions/build/action.yaml):

....
runs:
  using: "composite"
  steps:
   - name: build app
     run: build me ${{ input.param1}} ${{input.param2}}
   ...
   - name: Set up Docker Buildx
     id: buildx
     uses: docker/setup-buildx-action@v1.3.0
   ...

Turned out, I can’t use uses inside actions! Basically, there is no ability to reuse existing code, isn’t it?

How to create a large workflow then? By using aggressive copypaste? By using third party tools?

That’s right, at present composite actions do not support the use of other actions. There’s an open discussion about composite actions which received a promising update last month:

I can’t give any information about timelines, but we are currently working on composite actions! :rocket: We plan on enabling the uses keyword, which allows us to support: […]

You might also find Centrally managed workflow templates on the GitHub Roadmap helpful, which is currently targeting Q3 2021.

If you have an absolutely critical need for reducing workflow reuse in your organisation then there are options, i.e: you could hack your way to achieving this, but based on my own experience I would highly recommend holding out until the official support is released through either of the above.

2 Likes