actions ref_name is returning full ref ("ref/heads/*") instead of shortened name #11053

Closed
opened 2025-11-02 09:26:13 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @nephatrine on GitHub (Jun 18, 2023).

Description

I decided to try 1.20.0-rc0 (had been using 1.19.3) and noticed what I believe to be a regression. When using ${{ gitea.ref_name }} in my actions to get the branch name, I'm now getting something like ref/heads/main instead of just main. Per the documentation and prior behaviour, I believe it should only be returning the name.

I have not tried fixing the issue myself, but I think the issue is that it is being set to refName.String() instead of refName.ShortName() in routers/api/actions/runner/utils.go.

Gitea Version

1.20.0-rc0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Alpine 3.18

How are you running Gitea?

I'm building it myself from the 1.20.0-rc0 tag and running it inside an alpine:latest docker container.

Database

SQLite

Originally created by @nephatrine on GitHub (Jun 18, 2023). ### Description I decided to try 1.20.0-rc0 (had been using 1.19.3) and noticed what I believe to be a regression. When using `${{ gitea.ref_name }}` in my actions to get the branch name, I'm now getting something like `ref/heads/main` instead of just `main`. Per the documentation and prior behaviour, I believe it should only be returning the name. I have not tried fixing the issue myself, but I think the issue is that it is being set to refName.String() instead of refName.ShortName() in `routers/api/actions/runner/utils.go`. ### Gitea Version 1.20.0-rc0 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Alpine 3.18 ### How are you running Gitea? I'm building it myself from the 1.20.0-rc0 tag and running it inside an alpine:latest docker container. ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 09:26:13 -06:00
Author
Owner

@nephatrine commented on GitHub (Jun 18, 2023):

The fix does appear to be that simple. I've built and tested with that simple refName.ShortName() fix I referred to and it seems to work fine on my end.

@nephatrine commented on GitHub (Jun 18, 2023): The fix does appear to be that simple. I've built and tested with that simple refName.ShortName() fix I referred to and it seems to work fine on my end.
Author
Owner

@nephatrine commented on GitHub (Jun 19, 2023):

Thank you!

@nephatrine commented on GitHub (Jun 19, 2023): Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11053