Github actions/github-script 不打印输入

问题描述 投票:0回答:1

我有以下可重复使用的

on:
  workflow_call:
    inputs:
      base_os:
        description: "The base os"
        type: string
        required: true


jobs:
  upstream-image-name:
    name: get the image name for the upstream image
    runs-on: ubuntu-latest

    steps:

      - name: get upstream image name
        id: upstream-image-name-step
        uses: actions/github-script@v6
        with:
          result-encoding: string
          script:
            console.log('base_os =', core.getInput('base_os'))

我按如下方式调用它

on:
  push:
    branches:
      - reusable-runtime

jobs:
  invoke-reusable:
    name: test invocation of reusable
    uses: Repo/Owner/.github/workflows/reusable_runtime.yaml@reusable-runtime
    with:
      base_os: debian

日志

Run actions/github-script@v6
base_os = 

我错过了什么?

github continuous-integration github-actions pipeline workflow
1个回答
0
投票

core.getInput
不会直接从工作流程输入中获取输入。你需要像这样传递它:

on:
  workflow_call:
    inputs:
      base_os:
        description: "The base os"
        type: string
        required: true


jobs:
  upstream-image-name:
    name: get the image name for the upstream image
    runs-on: ubuntu-latest

    steps:

      - name: get upstream image name
        id: upstream-image-name-step
        uses: actions/github-script@v6
        with:
          result-encoding: string
          base_os: ${{ inputs.base_os }}
          script:
            console.log('base_os =', core.getInput('base_os'))
© www.soinside.com 2019 - 2024. All rights reserved.