英文:
fetch-depth: 0 on github actions checkout is not fetching all tags and refs
问题
我有一个仓库,在主分支上有一个标签1.0.0,我正在分支"dev"上运行GitHub工作流程
steps:
- name: "Checkout Application repo"
uses: actions/checkout@v3
with:
repository: ${{ inputs.repo_name }}
token: ${{ secrets.token }}
fetch-depth: 0
- name: Gitversion
id: git-version
run: |
cd ${{github.workspace}}
$GitVersion = dotnet-gitversion /output json |ConvertFrom-Json
echo $GitVersion.SemVer
我期望使用连续交付模式的语义版本是1.1.0,但实际语义版本是1.0.1,我尝试列出git分支-l以查看所有列出的分支,但我只看到了dev分支,fetch-depth: 0应该包含所有分支和标签信息。
我在这里缺少什么?
英文:
I have a repo which has a TAG 1.0.0 on main and i am running a github workflow on branch "dev"
steps:
- name: "Checkout Application repo"
uses: actions/checkout@v3
with:
repository: ${{ inputs.repo_name }}
token: ${{ secrets.token }}
fetch-depth: 0
- name: Gitversion
id: git-version
run: |
cd ${{github.workspace}}
$GitVersion = dotnet-gitversion /output json |ConvertFrom-Json
echo $GitVersion.SemVer
I expect the semver to be 1.1.0 using Continous delivery mode , however the Semever is 1.0.1 and i tried to list git branch -l to see all branches listed , but i only see dev branch there with fetch-depth : 0 it should have all branch and tag information
what am i am missing here?
答案1
得分: 1
我知道现在有点晚了,但我还是要添加这个答案,因为这个问题最接近我遇到的情况,也许还有其他人可以避免整天搜索。
我当时遇到了与你完全相同的问题。我试图在GitHub操作中使用GitVersion。我已经添加了一个带有版本号的标签,一切在本地都正常工作,但在构建服务器上,看起来Git似乎没有获取标签。我已经推送了所有更改,就我所见,远程Git仓库与我的本地仓库完全相同。经过一天的尝试使构建正常工作,并进入不同的兔子洞,最后,我在不同的文件夹中在本地克隆了仓库,结果,没有标签!
所以,一个谷歌搜索之后:
git push --tags
现在GitVersion在GitHub操作中可以工作了。
英文:
I know this is a bit late but I'm just going to add this answer because this question is the closest to what I was going through and maybe someone else will be saved from googling a whole day.
I was facing exactly the same issue as you. I was trying to use GitVersion in a GitHub action. I had added a tag with a version number and everything worked locally, but on the build server It looked like git was not fetching tags. I had push all changed and as far as I could see the remote git repo was identical to my local repo. After a day of trying to get the build to work and venturing into different rabbit holes I finally, cloned the reop locally in a different folder and behold, no tag!
So one google search later
git push --tags
And now GitVersion works in the GitHub action.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论