1

I'm using github environments in my github workflow. I want to read the environment name in a step of a job. According to this documentation. It seems that the job context does not have that information. Is it any other way to achieve this?

Basically this is what i want to achieve:

jobs:
   deployment:
    name: Deploy to dev
    environment: dev
    runs-on: ubuntu-latest
    steps:
      - run: echo ${{ job.environment.name }}
        # Expected to print 'dev'
Diego
  • 666
  • 1
  • 8
  • 27

1 Answers1

1

you should use: jobs.<job_id>.environment. See in docs: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment

Teddy
  • 11
  • 1