【发布时间】:2022-01-15 00:51:32
【问题描述】:
我正在尝试将秘密传递给可重用的工作流程,如下所示: https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow
但是流水线失败了,说明:
The workflow is not valid. .github/workflows/test.workflow-test.yml (Line: 17, Col: 9): Unexpected value 'secrets'
我的 .github/actions/test/action.yml 看起来像这样:
name: Reusable workflow example
on:
workflow_call:
inputs:
username:
required: true
type: string
secrets:
token:
required: true
jobs:
example_job:
name: show
runs-on: ubuntu-latest
steps:
- name: show data
runs: echo ${{ secrets.token }}
我相应地称呼它:
name: Call a reusable workflow
on:
push:
branches:
- "feature/workflow-test"
jobs:
my-test-job:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: ./.github/actions/test
with:
username: John
secrets:
token: secret Token
我在这里缺少什么?它与 GitHub 文档中的代码示例几乎相同。
【问题讨论】:
-
Per docs.github.com/en/actions/learn-github-actions/… 一个步骤没有密钥。
标签: yaml devops github-actions