question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to inject shell to composite action

See original GitHub issue

Describe the bug Unable to pass the shell via input parameter to the composite action.

To Reproduce Steps to reproduce the behavior:

  1. create following composite action:
name: 'test actions'
description: 'test action description'
inputs:
  shell:
    description: 'shell to use'
    required: false
    default: bash
runs:
  using: "composite"
  steps:
    - name:
      run: echo "bla bla bla"
      shell: ${{ inputs.shell}}
  1. use the action in some workflow
  2. Job fails on the ‘Set up job’ phase, printing the following errors:
Current runner version: '2.274.2'
Operating System
Virtual Environment
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'msys2/setup-msys2@v2'
Download action repository 'actions/checkout@main'
Download action repository 'myci-actions/add-pacman-repo@master'
Error: myci-actions\add-pacman-repo\master\action.yml (Line: 25, Col: 14):
Error: myci-actions\add-pacman-repo\master\action.yml (Line: 25, Col: 14): Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.shell
Error: GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid. myci-actions\add-pacman-repo\master\action.yml (Line: 25, Col: 14): Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.shell
   at GitHub.DistributedTask.ObjectTemplating.TemplateValidationErrors.Check()
   at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext, TemplateContext templateContext, TemplateToken inputsToken, String f[...]
Error: Fail to load myci-actions\add-pacman-repo\master\action.yml

where (Line: 25, Col: 14) corresponds to the last line of the action from step 1. I.e. shell: ${{ inputs.shell}}

Expected behavior The action works fine and uses the shell passed in as input argument to the action.

Runner Version and Platform

windows-latest

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
iamFIREcrackercommented, Oct 26, 2021

FYI, rather than duplicating steps, I ended up sym-linking OS-specific shells to a known location, and changed my steps to specify that new location as shell parameter.

    - name: Create bash-or-msys2
      shell: bash
      run: |
        if [[ "$RUNNER_OS" == "Windows" ]]; then
            powershell New-Item -ItemType SymbolicLink \
              -Path  "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" \
              -Target "D:/a/_temp/setup-msys2/msys2.cmd"
        else
            sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2
        fi
        ...
    - name: Upgrade ASDF to the Latest Version
      shell: bash-or-msys2 {0}
      run: |
        if [[ "${{ inputs.asdf-version }}" != "latest" ]]; then
            echo ::group::Installing ASDF ${{ inputs.asdf-version }}
            ros install asdf/${{ inputs.asdf-version }}
        else
            echo ::group::Installing latest ASDF
            ros install asdf
        fi
        echo ::endgroup::

Not ideal, but not as ugly as duplicating each and every step.

1reaction
ironstas1kcommented, Sep 5, 2022

We are still experiencing this issue using ubuntu-latest runners.

The workflow is not valid. .github/workflows/workflow_test.yml (Line: 20, Col: 16): Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.shell .github/workflows/workflow_test.yml (Line: 24, Col: 16): Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.shell

Workflow

name: Workflow Tests

on:
  workflow_dispatch:
    inputs:
      shell:
        description: 'shell to use'
        required: false
        default: bash
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Verify parameters
        run: echo "cond step"
        shell: ${{ inputs.shell }}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Github composite action output can not be set from within a ...
For one of my projects, I am setting an action output from within a bash script that is executed inside a composite action....
Read more >
GitHub Composite Actions - STOP wasting your time and ...
A composite run steps action allows you to combine multiple workflow run steps within one action. ... Your browser can't play this video....
Read more >
Creating a GitHub Composite Action
Composite actions allow you to combine multiple steps into one. The current Sonarcloud YAML I use is below – it's fairly long and...
Read more >
Composite Actions vs Reusable Workflows
Reusable workflows have many limitations that aren't mentioned here, and their only real advantage is the ability to execute steps in parallel ...
Read more >
GitHub Actions Security Best Practices [cheat sheet included]
Learn how to secure your GitHub Actions with these best practices! From controlling credentials to using specific action version tags, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found