Skip to content

Add environment name to a context available within a step #1369

Open
@aoggz

Description

Describe the enhancement

Include job.<job_id>.environment (if just name provided) or job.<job_id>.environment.name in a context available to a step, if set.

Code Snippet

Something like what's below would be great:

jobs:
  deploy-dev:
    environment: dev
    steps:
      - name: deploy
        uses: ./.github/actions/deploy-action
        with:
          environment: ${{job.environment_name}}

Additional information

It would be great if I could grab the desired name of the environment within a job that has the environment object set. I'm retrieving this by parsing the workflow YAML file based with help from the GITHUB_WORKFLOW and GITHUB_JOB environment variables, but this isn't ideal and introduces unneeded complexity (i.e. if the top-level name property within the workflow is set, then I have to dig within each YAML and check the name of the workflow).

I'm assuming that only the name would be available (if at all), since we can set the environment URL based on outputs from within a step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    futureFeature work that we haven't prioritizedpapercut

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions