Nested composite actions
See original GitHub issueI would like to be able to create a composite action that contains other composite actions. This does not seem to currently work.
For example, there are four steps that go into installing Python and using pipenv to install and cache dependencies. I’d like to create a single composite action that does everything involved so I don’t have to reproduce all of the steps in each of my workflows. I imagine such an action would look like this:
name: 'Python and pipenv installer'
description: 'Install all the things with Python and pipenv'
inputs:
python-version:
description: 'The version of Python to install'
required: false
default: 3.8
runs:
using: "composite"
steps:
- id: install-python
name: Install Python 3.8
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python-version }}
- id: install-pipenv
name: Install pipenv
run: |
python -m pip install --upgrade --no-cache-dir pip
python -m pip install --no-cache-dir pipenv
shell: bash
- id: cache-dependencies
name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/.cache/pipenv
key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-
${{ runner.os }}-
- id: sync-pipfile
name: Install dependencies with pipenv
run: pipenv sync
shell: bash
However, that does not seem to work. I get an error complaining like this when I try to use it.
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 13, Col: 7): Unexpected value 'uses'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 14, Col: 7): Unexpected value 'with'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 11, Col: 7): Required property is missing: run
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 11, Col: 7): Required property is missing: shell
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 26, Col: 7): Unexpected value 'uses'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 27, Col: 7): Unexpected value 'with'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 24, Col: 7): Required property is missing: run
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 13, Col: 7): Unexpected value 'uses'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 14, Col: 7): Unexpected value 'with'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 11, Col: 7): Required property is missing: run
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 11, Col: 7): Required property is missing: shell
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 26, Col: 7): Unexpected value 'uses'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 27, Col: 7): Unexpected value 'with'
Error: datadesk/python-pipenv-installer-action/v3/action.yaml (Line: 24, Col: 7): Required property is missing: run
Error: System.ArgumentException: Unexpected type '' encountered while reading 'steps item uses'. The type 'StringToken' was expected.
My presumption is that this means I can’t have composite actions inside my composite. I suspect this is a common use case and I’d love to see a solution of some form.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:28
- Comments:5
Top Results From Across the Web
GitHub Composite Actions - STOP wasting your time and ...
A composite run steps action allows you to combine multiple workflow run steps within one action. For example, you can use this feature...
Read more >Nested templates (calling a yaml file from another ...
You can use composite run steps actions. These are actions that are solely defined in YAML (documentation). You can now specify containers, ...
Read more >Composite Actions vs Reusable Workflows - DevPress
The first one is about nesting. Composite Actions can be nested up to 10 layers. This means you can create a Composite Action...
Read more >Using Composite GitHub Actions to make your Workflows ...
Composite Actions can be used to make GitHub Workflows smaller and more reusable. Find out what they are and how they work.
Read more >GitHub Actions: Composite Run Steps
August 7, 2020. You can now create reusable actions using shell scripts and even mix multiple shell languages in the same action.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We are hoping to support this soon, up to a certain depth level of ~9 or so. I’ll follow up with more information once this is live.
Thanks for landing this! When refactoring a workflow where
shell
is absent from arun
step one needs to be explicit aboutshell
. Isbash
the recommended default? What would be the most generic explicit setting?