-
I'm not sure if I'm doing something wrong or if environments just don't play nice with I have a generic job that performs various checks against a cloud provider. As input I have tried: name: trigging workflow
on:
workflow_dispatch:
jobs:
check:
environment: cloud_one
uses: my-org/my-repo/.github/workflows/generic-check.yml@main
with:
count: 0
secrets:
token: ${{ secrets.cloud_token }} name: triggered workflow
on:
workflow_call:
secrets:
token:
required: true
type: string
inputs:
count:
required: true
type: number
jobs:
check:
runs-on: ubuntu-latest
steps:
B) passing an environment string, (the environment contains the options/config items as a secret): name: trigging workflow
on:
workflow_dispatch:
jobs:
check:
uses: my-org/my-repo/.github/workflows/generic-check.yml@main
with:
myenv: cloud_one
count: 0 name: triggered workflow
on:
workflow_call:
inputs:
count:
required: true
type: number
jobs:
check:
# also test with a hardcoded value
environment: ${{ inputs.myenv }}
runs-on: ubuntu-latest
steps:
both of these seem to not be working for me. Where A) gives an error like Both workflows are in the same internal repo, and there are no environment protection rules. Happy to try and provide any additional context that might be helpful. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Case AEnvironments can only be specified in the triggered workflow, not in the triggering one. Hovering the red wavy underline will reveal a popup menu describing the cause of the error. It would be nice to include this gotcha it in the limitations section of the official documentation. Case BWorking example
|
Beta Was this translation helpful? Give feedback.
-
Example with environment secretsGiven an environment named
|
Beta Was this translation helpful? Give feedback.
Example with environment secrets
Given an environment named
example
containing an environment secret namedTOKEN
, the followingtriggered
workflow will have access to that secret:.github/workflows/triggering.yml
.github/workflows/triggered.yml