In GitHub Workflow I'm looking for a build-in variable which would contain the name of the current GH deployment environment (e.g. "staging"
) or be blank/unset if no such thing exist.
Since there doesn't seem to be a build-in variable for it (perhaps I'm overlooking it?), is there another way that this value can be obtained from within a pipeline step?
Here's an example workflow:
jobs:
job1:
runs-on: ubuntu-latest
environment: uat
steps:
- name: 'Print name'
run: echo "GH deployment env : ..."
job2:
runs-on: ubuntu-latest
environment: staging
steps:
- name: 'Print name'
run: echo "GH deployment env : ..."
run: echo '${{ toJSON(github) }}'
– Justiceshipdeployment
object in your job github context? If I remember correctly, in that case there would be 2 fieldsenvironment
andoriginal_environment
there (edit: I found an example in this workflow run, in the Dump Github Context step): Usingevent.deployment.environment
should return the value in the workflow. – Lopearedgithub
context (when printed using${{ toJSON(github) }}
) does not have anydeployment
object, nor can I find any documentation that it is supposed to have that. – Idiomorphic