Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nephatrine opened this issue Jun 18, 2023 · 2 comments · Fixed by #25358
Closed

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

nephatrine opened this issue Jun 18, 2023 · 2 comments · Fixed by #25358
Labels

Comments

@nephatrine
Copy link
Contributor

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

@nephatrine
Copy link
Contributor Author

nephatrine commented 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.

lunny pushed a commit that referenced this issue Jun 19, 2023
Fix #25357 .

Just a simple fix the result of `${{ gitea.ref_name }}` to show the
shortened name rather than the full ref.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jun 19, 2023
Fix go-gitea#25357 .

Just a simple fix the result of `${{ gitea.ref_name }}` to show the
shortened name rather than the full ref.
@nephatrine
Copy link
Contributor Author

Thank you!

silverwind pushed a commit that referenced this issue Jun 19, 2023
Backport #25358 by @nephatrine

Fix #25357 .

Just a simple fix the result of `${{ gitea.ref_name }}` to show the
shortened name rather than the full ref.

Co-authored-by: Daniel Wolf <1461334+nephatrine@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant