Home > OS >  How do I reference the deployment environment name in Github Actions workflow YAML?
How do I reference the deployment environment name in Github Actions workflow YAML?

Time:12-25

I would like to access the deployment environment name in my Github Actions workflow YAML. Here is an example:

jobs:
  example:
    runs-on: ubuntu-latest
    environment: "foobarbaz"
    ...

    steps:
      ...
      - name: Terraform Check Format
        id: terraform-fmt
        # what should I use here instead of "????" to get "foobarbaz"?
        run: terraform -chdir=terraform/stacks/${{ ???? }}/${{ matrix.stack }} fmt -check

CodePudding user response:

Should be stored under:

${{ github.jobs.example.environment }}
${{ github.jobs.example.environment.url }}

See:

  • Related