我有这个步骤:
- name: getSumac
uses: actions/checkout@v2
with:
repository: yma/sumac
ref: ${{ github.ref }}当通过推送标签来触发操作时,这是有效的。但是当创建或更新PR时,github.ref类似于refs/pull/99/merge,并且getSumac步骤失败。
在命令行上,我会运行类似于$( git describe --tags | grep -Eo '^v[.0-9]+' )的命令来获取最新的标记。有没有办法在github操作步骤中做到这一点?
发布于 2021-10-27 23:40:58
在本例中,我可以设置一个VERSION环境变量,这样我就可以这样做:
steps:
- name: Override the VERSION env var
run: |
VERSION=${VERSION:-$(git describe --tags | sed 's/^v//')}
if [ -n "$VERSION" ] ; then
echo "VERSION=$VERSION" >> $GITHUB_ENV
fi我使用的操作只使用$GITHUB_ENV (我从未在其他步骤中显式引用过它)。
https://stackoverflow.com/questions/69684409
复制相似问题