My workflow:
name: test
on:
workflow_call:
inputs:
env:
description: 'Test'
default: 'stage'
required: true
type: string
From docs reusable workflows:
jobs:
call-workflow-passing-data:
uses: octo-org/example-repo/.github/workflows/reusable-workflow.yml@main
with:
config-path: .github/labeler.yml
secrets:
envPAT: ${{ secrets.envPAT }}
But I dont understand where do I pass my "env" input variable when i call the workflow in a different workflow? would it be considered a secret? So I just gotta do
secrets:
env: "someEnv"
Is it like this?
Or should I modify this:
with:
config-path: .github/labeler.yml
To this:
with:
env: "abc"
As stated in the link you shared, there are two different types of inputs you can customize in reusable workflows: The inputs field, and the secrets field.
Example with the inputs field:
name: example1
on:
workflow_call:
inputs:
env:
description: 'Test'
default: 'stage'
required: true
type: string
This workflow will be called by using:
jobs:
example1:
uses: <ORG>/<REPO>/.github/workflows/reusable-workflow.yml@main
with:
env: 'ENV_VALUE'
Example with the secrets field:
name: example2
on:
workflow_call:
secrets:
env:
description: 'Test'
required: true
This workflow will be called by using:
jobs:
example2:
uses: <ORG>/<REPO>/.github/workflows/reusable-workflow.yml@main
secrets:
env: ${{ secrets.SECRET_NAME }}
Example with both inputs and secrets field:
name: example3
on:
workflow_call:
inputs:
env:
description: 'Test'
default: 'stage'
required: true
type: string
secrets:
env:
description: 'Test'
required: true
This workflow will be called by using:
jobs:
example3:
uses: <ORG>/<REPO>/.github/workflows/reusable-workflow.yml@main
with:
env: 'ENV_VALUE'
secrets:
env: ${{ secrets.SECRET_NAME }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With