Open xoxys opened 10 months ago
There shouldn't be a branch in this env var on tag events (it should be empty)
I think we agree on how it should be :smile:
Tags don't have branches - they are only created on top of commits, so there shouldn't be a branch I think
Not sure if I understand your comments. Yes there should be no branch information on tag events, as reported in the initial post there is a wrong branch information on tag evens in case an annotated tag was used.
The git plugin creates a local branch + git init -b refs/tags/v3.1.0
on checkouts. The plugin does this if branch
== CI_COMMIT_BRANCH
is not empty https://github.com/woodpecker-ci/plugin-git/blob/main/plugin.go#L210-L216 and it is using the provided branch name.
As in my case git init -b refs/tags/v3.1.0
is executed CI_COMMIT_BRANCH
has to be set to refs/tags/v3.1.0
by the server for whatever reason, which is wrong and the reason for this report.
Ah, I think I misunderstood the issue 🙃
No worries sorry if the initial description was not clear enough.
Component
server
Describe the bug
On a tag event, I got this issue with Python poetry:
Looks like the reason is that the clone step is doing
+ git init -b refs/tags/v3.1.0
, the root cause seems to be an issue with theCI_COMMIT_BRANCH
information provide by the server while using annotated tags:git tag v1.0.0
results in the correct default branch, e.g.main
git tag -a v1.0.0 -m ...
results in branchrefs/tags/...
System Info