我是否需要引号来替换字符串中的 Github 工作流替换?

Do I need quotes to substitute Github workflow substitution in string?

我像这样定义了 Github 工作流操作的输入。为了创建字符串值,我将替换用双引号括起来,以遵循它在 Bash:

中的样子
 uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
    env:
      API_TOKEN_GITHUB: ${{ secrets.GH_API_TOKEN }}
    with:
      source_file: "${{ steps.create-copy-file.outputs.filename }}.yaml"
      destination_repo: "${{ github.repository_owner }}/repo"
      destination_folder: "releases/${{ steps.create-copy-file.outputs.target_folder }}"
      user_email: "user@mail.com"
      user_name: "User Name"

但是,examples in Github 表明我可以替换该值而无需将其括在引号中。我尝试在没有引号的情况下定义上面的值,它们似乎有效,即文件已正确复制到目标存储库和文件夹。

 uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
    env:
      API_TOKEN_GITHUB: ${{ secrets.GH_API_TOKEN }}
    with:
      source_file: ${{ steps.create-copy-file.outputs.filename }}.yaml
      destination_repo: ${{ github.repository_owner }}/repo
      destination_folder: releases/${{ steps.create-copy-file.outputs.target_folder }}
      user_email: user@mail.com
      user_name: "User Name"

我尝试在 Github 中查找示例以了解是否允许或建议这种做法,但找不到任何示例。我找到的一个示例来自这个 Azure 开发人员页面(示例 6):https://docs.microsoft.com/en-us/azure/developer/github/github-variable-substitution.

Another example,将字符串用双引号引起来。

我的问题是,是否有必要将 Github 工作流程中的字符串替换用 single/double 引号引起来?这是官方支持的功能还是意外的功能?

不,一般不需要引号。工作流文件是 YAML,这都是关于 YAML 中的引号:

YAML: Do I need quotes for strings in YAML?