github context not available in environnment
Describe the bug
I want to use a workflow for deployment to different environments. This workflow takes the environment as input using workflow dispatch:
on:
workflow_dispatch:
inputs:
env:
description: Environment to deploy to
required: true
default: dev
jobs:
deploy:
name: Update active theme
environment: ${{ github.event.inputs.env }}
This fails with an error:
The workflow is not valid. .github/workflows/deploy.yaml (Line: 21, Col: 18): Unrecognized named-value: 'github'. Located at position 1 within expression: github.event.inputs.env
To Reproduce Steps to reproduce the behavior:
- Create a workflow with a
workflow-dispatchtrigger - Add a job with an
environmentreference a dispatch input, for exampleenvironment: ${{ github.event.inputs.env }} - Trigger the workflow
Expected behavior I would expect it to be possible to use event input to set the job environment.
Runner Version and Platform
GitHub Enterprise 3.1.7
What's not working?
The github context is not available when evaluation the expression for environment in a job.
There is an unexpected workaround: the github context is available in the jobs.environment.name field.
jobs:
deploy:
name: Update active theme
environment:
name: ${{ github.event.inputs.env }}
There is a related GitHub Community thread for this issue.
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.
This issue was closed because it has been stalled for 15 days with no activity.