-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Clarify Actions resources ownership #31724
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wolfogre
added
type/enhancement
An improvement of existing functionality
topic/gitea-actions
related to the actions of Gitea
labels
Jul 29, 2024
GiteaBot
added
the
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
label
Jul 29, 2024
pull-request-size
bot
added
the
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
label
Jul 29, 2024
github-actions
bot
added
modifies/api
This PR adds API routes or modifies them
modifies/go
Pull requests that update Go code
labels
Jul 29, 2024
github-actions
bot
removed
the
modifies/api
This PR adds API routes or modifies them
label
Jul 29, 2024
This was referenced Jul 29, 2024
lafriks
pushed a commit
that referenced
this pull request
Jul 29, 2024
GiteaBot
pushed a commit
to GiteaBot/gitea
that referenced
this pull request
Jul 29, 2024
Fix go-gitea#31707. It's split from go-gitea#31724. Although go-gitea#31724 could also fix go-gitea#31707, it has change a lot so it's not a good idea to backport it.
Zettat123
reviewed
Jul 30, 2024
wolfogre
added a commit
that referenced
this pull request
Jul 30, 2024
Zettat123
approved these changes
Jul 30, 2024
GiteaBot
added
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
and removed
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
labels
Jul 30, 2024
lunny
approved these changes
Aug 1, 2024
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
Aug 1, 2024
wolfogre
added
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
Aug 1, 2024
GiteaBot
removed
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
Aug 1, 2024
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Aug 2, 2024
* giteaofficial/main: Clear up old Actions logs (go-gitea#31735) Fix createElementFromAttrs bug (go-gitea#31751) bump vue-bar-graph (go-gitea#31705) Use UTC as default timezone when schedule Actions cron tasks (go-gitea#31742) Add permission description for API to add repo collaborator (go-gitea#31744) Clarify Actions resources ownership (go-gitea#31724) Exclude protected branches from recently pushed (go-gitea#31748) [skip ci] Updated translations via Crowdin Distinguish LFS object errors to ignore missing objects during migration (go-gitea#31702)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
modifies/go
Pull requests that update Go code
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
topic/gitea-actions
related to the actions of Gitea
type/enhancement
An improvement of existing functionality
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #31707.
Also related to #31715.
Some Actions resources could has different types of ownership. It could be:
There are two ways to distinguish org/user level from repo level:
{owner_id: 1, repo_id: 2}
for repo level, and{owner_id: 1, repo_id: 0}
for org level.{owner_id: 0, repo_id: 2}
for repo level, and{owner_id: 1, repo_id: 0}
for org level.The first way seems more reasonable, but it may not be true. The point is that although a resource, like a runner, belongs to a repo (it can be used by the repo), the runner doesn't belong to the repo's org (other repos in the same org cannot use the runner). So, the second method makes more sense.
And the first way is not user-friendly to query, we must set the repo id to zero to avoid wrong results.
So, #31715 should be right. And the most simple way to fix #31707 is just:
However, it is quite intuitive to set both owner id and repo id since the repo belongs to the owner. So I prefer to be compatible with it. If we get both owner id and repo id not zero when creating or finding, it's very clear that the caller want one with repo level, but set owner id accidentally. So it's OK to accept it but fix the owner id to zero.