actions / actions/runner

Cannot pass dynamic environment from input

Open
#3,307 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Describe the bug
Reusable workflow cannot get inputs passed from a main workflow

To Reproduce
Steps to reproduce the behavior:

dev/action.yml

name: Reusable workflow
on:
  workflow_dispatch:
    inputs:
      source-environment:
        required: true
        type: string
  workflow_call:
    inputs:
      source-environment:
        required: true
        type: string
jobs:
  build-and-push:
    name: Build and Push
    runs-on: ubuntu-latest
    environment: 
      name: ${{ inputs.source-environment }}
    secrets: inherit
    steps:
      - run: echo "${{ inputs.source-environment }}"
        shell: bash

main_workflow.yml

jobs:
  action-dev:
    if: github.ref == 'refs/heads/main'
    environment: develop
    name: Deploy to Dev
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Reuse action
        uses: ./.github/actions/dev
        with:
          source-environment: develop

I have tried to use github.event.inputs.source-environment as well and also doesn't work

Expected behavior
Expect develop is output in the console

Runner Version and Platform

ubuntu-latest

What's not working?

Unrecognized named-value: 'inputs'
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reusable workflow example in .github/actions/dev/action.yml and the caller in main_workflow.yml, then verify how the runner parses inputs in this invocation. Reproduce the Unrecognized named-value: 'inputs' error and compare it with the documented reusable-workflow entry point. Done means the supported configuration either accepts the passed environment or the issue is clarified as an unsupported usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, yaml
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.