【发布时间】:2020-06-11 10:38:32
【问题描述】:
我有一个如下的 github 存储库
johndoe/hello-world
我正在尝试在 github 操作中设置以下环境变量
env:
DOCKER_HUB_USERID: ${{ github.actor }}
REPOSITORY_NAME: ${GITHUB_REPOSITORY#*\/}
IMAGE_NAME_CLIENT: "$REPOSITORY_NAME-client"
IMAGE_NAME_SERVER: "$REPOSITORY_NAME-server"
我对这些变量的预期结果是:
johndoe
hello-world
hello-world-client
hello-world-server
但我得到了
johndoe
${REPOSITORY_NAME#*\/}
$REPOSITORY_NAME-client
$REPOSITORY_NAME-server
在声明 env 变量时,似乎没有计算表达式。
我怎样才能达到预期的行为?
【问题讨论】:
-
对于第二个,为什么不
${{github.repository}},类似于第一个有效?从here 看来可以。 -
${{github.repository}}包含用户名...我想在没有用户名的情况下获取它
标签: github environment-variables pipeline github-actions building-github-actions