我的工作流程:
name: test
on:
workflow_call:
inputs:
env:
description: 'Test'
default: 'stage'
required: true
type: string来自docs 可重用工作流
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 }}但是,当我在另一个工作流中调用工作流时,我不明白在哪里传递我的"env“输入变量?会被认为是秘密吗?所以我要做的就是
secrets:
env: "someEnv"是这样的吗?
或者我应该修改这个:
with:
config-path: .github/labeler.yml对此:
with:
env: "abc"发布于 2022-11-29 14:22:49
正如您共享的链接中所述,可以在可重用工作流中自定义两种不同类型的输入:inputs字段和secrets字段。
使用inputs 字段的示例:
name: example1
on:
workflow_call:
inputs:
env:
description: 'Test'
default: 'stage'
required: true
type: string将通过以下方法调用此工作流:
jobs:
example1:
uses: <ORG>/<REPO>/.github/workflows/reusable-workflow.yml@main
with:
env: 'ENV_VALUE'使用secrets 字段的示例:
name: example2
on:
workflow_call:
secrets:
env:
description: 'Test'
required: true将通过以下方法调用此工作流:
jobs:
example2:
uses: <ORG>/<REPO>/.github/workflows/reusable-workflow.yml@main
secrets:
env: ${{ secrets.SECRET_NAME }}inputs 和 secrets 字段的示例:
name: example3
on:
workflow_call:
inputs:
env:
description: 'Test'
default: 'stage'
required: true
type: string
secrets:
env:
description: 'Test'
required: true将通过以下方法调用此工作流:
jobs:
example3:
uses: <ORG>/<REPO>/.github/workflows/reusable-workflow.yml@main
with:
env: 'ENV_VALUE'
secrets:
env: ${{ secrets.SECRET_NAME }}https://stackoverflow.com/questions/74614687
复制相似问题