GitHub操作“ set-env”导致“没有这样的文件或目录”

时间:2020-05-04 16:34:10

标签: github github-actions

尝试基于当前提交SHA设置环境变量,以后将其用作文件名。我尝试过“ set-env”的多种变体,是否带有动态值,并且每次构建失败时都带有:

102A OK
1A OK
2  OK
110 OK
10A1 WRONG
BV WRONG

我从工作流程文档中引用:https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable

 Setup Additional Environment Variables0s
 ##[error]No such file or directory
 Run echo ::set-env name=TEST_FILE::test-${GITHUB_SHA}
   echo ::set-env name=TEST_FILE::test-${GITHUB_SHA}
   shell: /bin/bash -e {0}
 ##[error]No such file or directory

1 个答案:

答案 0 :(得分:0)

您可以使用-fPIC上下文来获取 sha 值。这是适合我的配置:

.github / workflows / test.yml

github

结果:

enter image description here