GitHub Actions 中的环境与可重用工作流程不兼容?

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

我有以下工作

  build-and-push-docker-image:
    name: Build and push docker image
    if: github.repository == 'Org/repo'
    uses: Org/repo/.github/workflows/reusable.yaml@main
    with:
      dockerfile: My_Dockerfile
    environment:
      name: Production
    needs:
      - job-1
      - job-2
    secrets:
      SECRET_1: ${{ secrets.SECRET_1 }}

基本语法检查失败,如下所示:

工作流程无效。 .github/workflows/my_workflow.yml(行:236,列:5):意外值“环境”

为什么会这样?

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

根据文档,不可能将

environment
与可重用的工作流一起使用。您必须在可重用工作流程中定义它。

参见此处:Supported keywords for jobs that call a reusable workflow

© www.soinside.com 2019 - 2024. All rights reserved.