Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git版本列表在github操作中不起作用_Git_Github_Github Actions - Fatal编程技术网

git版本列表在github操作中不起作用

git版本列表在github操作中不起作用,git,github,github-actions,Git,Github,Github Actions,我有一个github操作,在创建发布时触发 目标是: 查找发布所基于的标记 查找该分支上的上一个标记 到目前为止,我有: CURRENT_TAG=${{ github.event.release.tag_name }} PENULTIMATE_TAG=$(git describe --exact-match --tags `git rev-list --tags --max-count=1 --skip=1`) 然后,将这些数据回传出来进行测试。第一个可以正常工作,但第二个总是返回空。我在

我有一个github操作,在创建发布时触发

目标是:

  • 查找发布所基于的标记
  • 查找该分支上的上一个标记
到目前为止,我有:

CURRENT_TAG=${{ github.event.release.tag_name }}
PENULTIMATE_TAG=$(git describe --exact-match --tags `git rev-list --tags --max-count=1 --skip=1`)
然后,将这些数据回传出来进行测试。第一个可以正常工作,但第二个总是返回空。我在本地尝试了完全相同的命令,它返回了第二个最新的标记,正如预期的那样


我不知道为什么它在github操作中不起作用。为了调试,我删除了
git descripe
组件,确认实际上是git
rev list
没有返回任何内容。

需要通过传递获取深度选项来获取所有历史记录:

 - uses: actions/checkout@v2
      with:
        fetch-depth: 0

提示:浅克隆。增加深度或完全禁用浅克隆。@phd啊,找到了,谢谢!这真的很有帮助!。