gpt4 book ai didi

github - GitHub Actions 中的嵌套模板(从另一个 yaml 文件调用 yaml 文件)

转载 作者:行者123 更新时间:2023-12-04 11:47:14 29 4
gpt4 key购买 nike

GitHub 操作是否支持嵌套模板?例如,以下是 Azure Pipeline yaml 的示例,它调用另一个 yaml 文件:

- job: BuildFunctions

steps:
- ${{ each func in parameters.functionApps }}:
- template: yaml/build-functionapps.yml
parameters:
是否可以在 GitHub 操作中从另一个 yaml 文件调用 yaml 文件?

最佳答案

您可以使用复合运行步骤操作。这些是仅在 YAML ( documentation ) 中定义的操作。

You can now specify containers, other composite actions (up to a depth of 9) and node actions in additional to the previously available run steps


节点 Action 可能指的是叶 Action ,即不调用任何其他 Action 的 Action 。
来源: https://github.com/actions/runner/issues/646#issuecomment-901336347
工作流程
[...]

jobs:
job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/composite-action

[...]
复合运行 Action .github/workflows/composite-action/action.yml (与工作流相同的存储库)
name: "My composite action"
description: "Checks out the repository and does something"
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- run: npm test
shell: bash
- run: |
echo "Executing action"
shell: bash

旧限制:

What does composite run steps currently support?

For each run step in a composite action, we support:

  • name
  • id
  • run
  • env
  • shell
  • working-directory

In addition, we support mapping input and outputs throughout the action.

See docs for more info.

What does Composite Run Steps Not Support

We don't support setting conditionals, continue-on-error, timeout-minutes, "uses" [remark: i.e. using other actions], and secrets on individual steps within a composite action right now.

(Note: we do support these attributes being set in workflows for a step that uses a composite run steps action)


来源: https://github.com/actions/runner/issues/646

关于github - GitHub Actions 中的嵌套模板(从另一个 yaml 文件调用 yaml 文件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64055230/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com