如何在 github 操作工作流中引用“环境”?

时间:2021-01-12 21:59:06

标签: git github-actions

我创建了名为“main”的环境,但下面的工作流程出错: 创建的环境: enter image description here

以下是我的 github 工作流程:

Color

目前它注意到错误:

name: Deploy ADf ARM    

on:
  workflow_dispatch:

environment: 
  name: main

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:

      # Checkout code
    - uses: actions/checkout@main
      ...

我如何引用这个环境来工作?

1 个答案:

答案 0 :(得分:4)

It should be on job level

name: Deploy ADf ARM    

on:
  workflow_dispatch:



jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    environment: 
      name: main
    steps:

      # Checkout code
    - uses: actions/checkout@main
      ...