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

Set ref to fully-formed of the tag when trigger event is release #23944

Merged
merged 5 commits into from
Apr 7, 2023

Conversation

sillyguodong
Copy link
Contributor

Fix #23943
When trigger event is release, ref should be like refs/tags/<tag_name> instead of CommitID

@lunny lunny added type/bug outdated/backport/v1.19 This PR should be backported to Gitea 1.19 labels Apr 6, 2023
@lunny lunny added this to the 1.20.0 milestone Apr 6, 2023
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Apr 6, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 6, 2023
@delvh
Copy link
Member

delvh commented Apr 6, 2023

  1. Isn't changing the format of ref_name breaking?
  2. If yes, this change shouldn't be backported.
  3. Isn't this going to cause future problems where we cannot distinguish between what is intended for a tag, and what is intended for a branch?

@silverwind
Copy link
Member

Isn't changing the format of ref_name breaking

Tend to agree, I'd say it is breaking as some workflows may rely on the "broken" behaviour.

@silverwind silverwind added pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! and removed outdated/backport/v1.19 This PR should be backported to Gitea 1.19 labels Apr 6, 2023
@wolfogre
Copy link
Member

wolfogre commented Apr 7, 2023

I have a different opinion. It was previously incorrect, so what it broke was a mistake. I would say it's not breaking and should be backported.

See the comment.

The fully-formed ref of the branch or tag that triggered the workflow run. For workflows triggered by push, this is the branch or tag ref that was pushed. For workflows triggered by pull_request, this is the pull request merge branch. For workflows triggered by release, this is the release tag created. For other triggers, this is the branch or tag ref that triggered the workflow run. This is only set if a branch or tag is available for the event type. The ref given is fully-formed, meaning that for branches the format is refs/heads/<branch_name>, for pull requests it is refs/pull/<pr_number>/merge, and for tags it is refs/tags/<tag_name>. For example, refs/heads/feature-branch-1.

"ref": t.Job.Run.Ref, // string, The fully-formed ref of the branch or tag that triggered the workflow run. For workflows triggered by push, this is the branch or tag ref that was pushed. For workflows triggered by pull_request, this is the pull request merge branch. For workflows triggered by release, this is the release tag created. For other triggers, this is the branch or tag ref that triggered the workflow run. This is only set if a branch or tag is available for the event type. The ref given is fully-formed, meaning that for branches the format is refs/heads/<branch_name>, for pull requests it is refs/pull/<pr_number>/merge, and for tags it is refs/tags/<tag_name>. For example, refs/heads/feature-branch-1.

It follows https://docs.github.com/en/actions/learn-github-actions/contexts#github-context

@wolfogre wolfogre added outdated/backport/v1.19 This PR should be backported to Gitea 1.19 and removed pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! labels Apr 7, 2023
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 7, 2023
@silverwind silverwind enabled auto-merge (squash) April 7, 2023 19:02
@jolheiser
Copy link
Member

🎺 🤖

@silverwind silverwind merged commit 3876f56 into go-gitea:main Apr 7, 2023
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Apr 7, 2023
…o-gitea#23944)

Fix go-gitea#23943
When trigger event is `release`, ref should be like
`refs/tags/<tag_name>` instead of `CommitID`
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Apr 7, 2023
@jolheiser jolheiser removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 7, 2023
lunny pushed a commit that referenced this pull request Apr 8, 2023
…23944) (#23989)

Backport #23944 by @sillyguodong

Fix #23943
When trigger event is `release`, ref should be like
`refs/tags/<tag_name>` instead of `CommitID`

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 1, 2023
@sillyguodong sillyguodong deleted the bugfix/issue_23943 branch February 29, 2024 03:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. outdated/backport/v1.19 This PR should be backported to Gitea 1.19 type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't get tagname when workflow trigger event is release
7 participants