feat: update gitea vendor
runner nix smoke / nix label and flake smoke (push) Failing after 1m28s

This commit is contained in:
2026-09-26 21:18:24 +00:00
parent c439c1b948
commit d9b2a4e787
3538 changed files with 116131 additions and 44340 deletions
@@ -11,7 +11,6 @@ type CreateUserOption struct {
// The authentication source ID to associate with the user
SourceID int64 `json:"source_id"`
// identifier of the user, provided by the external authenticator (if configured)
// default: empty
LoginName string `json:"login_name"`
// username of the user
// required: true
@@ -30,7 +29,7 @@ type CreateUserOption struct {
// Whether the user has restricted access privileges
Restricted *bool `json:"restricted"`
// User visibility level: public, limited, or private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
Visibility UserVisibility `json:"visibility" binding:"In(,public,limited,private)"`
// For explicitly setting the user creation timestamp. Useful when users are
// migrated from other systems. When omitted, the user's creation timestamp
@@ -44,9 +43,7 @@ type EditUserOption struct {
// The authentication source ID to associate with the user
SourceID int64 `json:"source_id"`
// identifier of the user, provided by the external authenticator (if configured)
// default: empty
// required: true
LoginName string `json:"login_name" binding:"Required"`
LoginName *string `json:"login_name"`
// swagger:strfmt email
// The email address of the user
Email *string `json:"email" binding:"MaxSize(254)"`
@@ -79,5 +76,5 @@ type EditUserOption struct {
// Whether the user has restricted access privileges
Restricted *bool `json:"restricted"`
// User visibility level: public, limited, or private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
Visibility UserVisibility `json:"visibility" binding:"In(,public,limited,private)"`
}
@@ -1,7 +1,7 @@
// Copyright 2017 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs // import "code.gitea.io/gitea/modules/structs"
package structs // import "gitea.dev/modules/structs"
import (
"time"
+19 -1
View File
@@ -9,7 +9,7 @@ import (
"strings"
"time"
"code.gitea.io/gitea/modules/json"
"gitea.dev/modules/json"
)
// ErrInvalidReceiveHook FIXME
@@ -434,6 +434,10 @@ type ChangesPayload struct {
type PullRequestPayload struct {
// The action performed on the pull request
Action HookIssueAction `json:"action"`
// The SHA of the most recent commit on the PR head branch before the push
Before string `json:"before,omitempty"`
// The SHA of the most recent commit on the PR head branch after the push
After string `json:"after,omitempty"`
// The index number of the pull request
Index int64 `json:"number"`
// Changes made to the pull request (for edit actions)
@@ -571,6 +575,20 @@ func (p *WorkflowDispatchPayload) JSONPayload() ([]byte, error) {
return json.MarshalIndent(p, "", " ")
}
// WorkflowCallPayload is persisted on a reusable workflow caller job's CallPayload field.
type WorkflowCallPayload struct {
Workflow string `json:"workflow"`
Ref string `json:"ref"`
Inputs map[string]any `json:"inputs"`
Repository *Repository `json:"repository"`
Sender *User `json:"sender"`
}
// JSONPayload implements Payload
func (p *WorkflowCallPayload) JSONPayload() ([]byte, error) {
return json.MarshalIndent(p, "", " ")
}
// CommitStatusPayload represents a payload information of commit status event.
type CommitStatusPayload struct {
// TODO: add Branches per https://docs.github.com/en/webhooks/webhook-events-and-payloads#status
@@ -0,0 +1,59 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
import (
"testing"
"gitea.dev/modules/json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestPullRequestPayloadSynchronizeBeforeAfter(t *testing.T) {
payload := &PullRequestPayload{
Action: HookIssueSynchronized,
Before: "1111111111111111111111111111111111111111",
After: "2222222222222222222222222222222222222222",
Index: 12,
}
data, err := json.Marshal(payload)
require.NoError(t, err)
assert.JSONEq(t, `{
"action": "synchronized",
"before": "1111111111111111111111111111111111111111",
"after": "2222222222222222222222222222222222222222",
"number": 12,
"commit_id": "",
"pull_request": null,
"repository": null,
"requested_reviewer": null,
"review": null,
"sender": null
}`, string(data))
}
func TestPullRequestPayloadNonSynchronizeOmitsBeforeAfter(t *testing.T) {
payload := &PullRequestPayload{
Action: HookIssueOpened,
Index: 12,
}
data, err := json.Marshal(payload)
require.NoError(t, err)
assert.JSONEq(t, `{
"action": "opened",
"number": 12,
"commit_id": "",
"pull_request": null,
"repository": null,
"requested_reviewer": null,
"review": null,
"sender": null
}`, string(data))
}
+14 -4
View File
@@ -10,7 +10,7 @@ import (
"strings"
"time"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// StateType issue state type
@@ -60,6 +60,7 @@ type Issue struct {
Attachments []*Attachment `json:"assets"`
Labels []*Label `json:"labels"`
Milestone *Milestone `json:"milestone"`
Projects []*Project `json:"projects"`
// deprecated
Assignee *User `json:"assignee"`
Assignees []*User `json:"assignees"`
@@ -100,7 +101,9 @@ type CreateIssueOption struct {
Milestone int64 `json:"milestone"`
// list of label ids
Labels []int64 `json:"labels"`
Closed bool `json:"closed"`
// list of project ids
Projects []int64 `json:"projects"`
Closed bool `json:"closed"`
}
// EditIssueOption options for editing an issue
@@ -112,7 +115,9 @@ type EditIssueOption struct {
Assignee *string `json:"assignee"`
Assignees []string `json:"assignees"`
Milestone *int64 `json:"milestone"`
State *string `json:"state"`
// list of project ids to set (replaces existing projects)
Projects *[]int64 `json:"projects"`
State *string `json:"state"`
// swagger:strfmt date-time
Deadline *time.Time `json:"due_date"`
RemoveDeadline *bool `json:"unset_due_date"`
@@ -120,6 +125,11 @@ type EditIssueOption struct {
ContentVersion *int `json:"content_version"`
}
// IssueAssigneesOption options for adding/removing issue assignees
type IssueAssigneesOption struct {
Assignees []string `json:"assignees"`
}
// EditDeadlineOption options for creating a deadline
type EditDeadlineOption struct {
// required:true
@@ -226,7 +236,7 @@ func (l *IssueTemplateStringSlice) UnmarshalYAML(value *yaml.Node) error {
*l = labels
return nil
}
return fmt.Errorf("line %d: cannot unmarshal %s into IssueTemplateStringSlice", value.Line, value.ShortTag())
return fmt.Errorf("cannot unmarshal %s into IssueTemplateStringSlice", value.ShortTag())
}
type IssueConfigContactLink struct {
@@ -7,7 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
func TestIssueTemplate_Type(t *testing.T) {
@@ -88,7 +88,7 @@ labels:
b: bb
`,
tmpl: &IssueTemplate{},
wantErr: "line 3: cannot unmarshal !!map into IssueTemplateStringSlice",
wantErr: "yaml: unmarshal errors:\n line 3: cannot unmarshal !!map into IssueTemplateStringSlice",
},
}
for _, tt := range tests {
@@ -68,12 +68,12 @@ const (
type NotifySubjectType string
const (
// NotifySubjectIssue an issue is subject of an notification
// NotifySubjectIssue a issue is subject of an notification
NotifySubjectIssue NotifySubjectType = "Issue"
// NotifySubjectPull an pull is subject of an notification
// NotifySubjectPull a pull is subject of an notification
NotifySubjectPull NotifySubjectType = "Pull"
// NotifySubjectCommit an commit is subject of an notification
// NotifySubjectCommit a commit is subject of an notification
NotifySubjectCommit NotifySubjectType = "Commit"
// NotifySubjectRepository an repository is subject of an notification
// NotifySubjectRepository a repository is subject of an notification
NotifySubjectRepository NotifySubjectType = "Repository"
)
+3 -5
View File
@@ -22,7 +22,7 @@ type Organization struct {
// The location of the organization
Location string `json:"location"`
// The visibility level of the organization (public, limited, private)
Visibility string `json:"visibility"`
Visibility UserVisibility `json:"visibility"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
// username of the organization
@@ -60,8 +60,7 @@ type CreateOrgOption struct {
// The location of the organization
Location string `json:"location" binding:"MaxSize(50)"`
// possible values are `public` (default), `limited` or `private`
// enum: ["public","limited","private"]
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
Visibility UserVisibility `json:"visibility" binding:"In(,public,limited,private)"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
}
@@ -79,8 +78,7 @@ type EditOrgOption struct {
// The location of the organization
Location *string `json:"location" binding:"MaxSize(50)"`
// possible values are `public`, `limited` or `private`
// enum: ["public","limited","private"]
Visibility *string `json:"visibility" binding:"In(,public,limited,private)"`
Visibility *UserVisibility `json:"visibility" binding:"In(,public,limited,private)"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
}
@@ -4,6 +4,20 @@
package structs
// TeamVisibility controls who can list a team within its organization.
// - "public": visible to any signed-in user (still bounded by org visibility)
// - "limited": visible to any member of the parent organization
// - "private": visible only to team members and org owners
//
// swagger:enum TeamVisibility
type TeamVisibility string
const (
TeamVisibilityPublic TeamVisibility = "public"
TeamVisibilityLimited TeamVisibility = "limited"
TeamVisibilityPrivate TeamVisibility = "private"
)
// Team represents a team in an organization
type Team struct {
// The unique identifier of the team
@@ -15,9 +29,8 @@ type Team struct {
// The organization that the team belongs to
Organization *Organization `json:"organization"`
// Whether the team has access to all repositories in the organization
IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: ["none","read","write","admin","owner"]
Permission string `json:"permission"`
IncludesAllRepositories bool `json:"includes_all_repositories"`
Permission AccessLevelName `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
// Deprecated: This variable should be replaced by UnitsMap and will be dropped in later versions.
Units []string `json:"units"`
@@ -25,6 +38,11 @@ type Team struct {
UnitsMap map[string]string `json:"units_map"`
// Whether the team can create repositories in the organization
CanCreateOrgRepo bool `json:"can_create_org_repo"`
// Team visibility within the organization. "private" teams are only
// listable by members and org owners; "limited" teams are listable by
// any organization member; "public" teams are listable by any signed-in
// user.
Visibility TeamVisibility `json:"visibility"`
}
// CreateTeamOption options for creating a team
@@ -34,9 +52,8 @@ type CreateTeamOption struct {
// The description of the team
Description string `json:"description" binding:"MaxSize(255)"`
// Whether the team has access to all repositories in the organization
IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: ["read","write","admin"]
Permission string `json:"permission"`
IncludesAllRepositories bool `json:"includes_all_repositories"`
Permission RepoWritePermission `json:"permission"`
// example: ["repo.actions","repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.ext_wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
// Deprecated: This variable should be replaced by UnitsMap and will be dropped in later versions.
Units []string `json:"units"`
@@ -44,6 +61,8 @@ type CreateTeamOption struct {
UnitsMap map[string]string `json:"units_map"`
// Whether the team can create repositories in the organization
CanCreateOrgRepo bool `json:"can_create_org_repo"`
// Team visibility within the organization. Defaults to "private".
Visibility TeamVisibility `json:"visibility" binding:"OmitEmpty;In(public,limited,private)"`
}
// EditTeamOption options for editing a team
@@ -53,9 +72,8 @@ type EditTeamOption struct {
// The description of the team
Description *string `json:"description" binding:"MaxSize(255)"`
// Whether the team has access to all repositories in the organization
IncludesAllRepositories *bool `json:"includes_all_repositories"`
// enum: ["read","write","admin"]
Permission string `json:"permission"`
IncludesAllRepositories *bool `json:"includes_all_repositories"`
Permission RepoWritePermission `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
// Deprecated: This variable should be replaced by UnitsMap and will be dropped in later versions.
Units []string `json:"units"`
@@ -63,4 +81,7 @@ type EditTeamOption struct {
UnitsMap map[string]string `json:"units_map"`
// Whether the team can create repositories in the organization
CanCreateOrgRepo *bool `json:"can_create_org_repo"`
// Team visibility within the organization. When omitted, visibility is
// left unchanged.
Visibility *TeamVisibility `json:"visibility" binding:"OmitEmpty;In(public,limited,private)"`
}
@@ -0,0 +1,33 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
import (
"time"
)
// Project represents a project
// swagger:model
type Project struct {
// ID is the unique identifier for the project
ID int64 `json:"id"`
// Title is the title of the project
Title string `json:"title"`
// Description provides details about the project
Description string `json:"description"`
// OwnerID is the owner of the project (for org-level projects)
OwnerID int64 `json:"owner_id,omitempty"`
// RepoID is the repository this project belongs to (for repo-level projects)
RepoID int64 `json:"repo_id,omitempty"`
// CreatorID is the user who created the project
CreatorID int64 `json:"creator_id"`
// IsClosed indicates if the project is closed
IsClosed bool `json:"is_closed"`
// swagger:strfmt date-time
Created time.Time `json:"created_at"`
// swagger:strfmt date-time
Updated time.Time `json:"updated_at"`
// swagger:strfmt date-time
Closed *time.Time `json:"closed_at,omitempty"`
}
@@ -94,6 +94,11 @@ type CreatePullReviewComment struct {
NewLineNum int64 `json:"new_position"`
}
// CreatePullReviewCommentReplyOptions are options to reply to a pull request review comment
type CreatePullReviewCommentReplyOptions struct {
Body string `json:"body" binding:"Required"`
}
// SubmitPullReviewOptions are options to submit a pending pull request review
type SubmitPullReviewOptions struct {
Event ReviewStateType `json:"event"`
+30 -9
View File
@@ -8,6 +8,15 @@ import (
"time"
)
// ObjectFormatName is the git hash algorithm used by a repository.
// swagger:enum ObjectFormatName
type ObjectFormatName string
const (
ObjectFormatSHA1 ObjectFormatName = "sha1"
ObjectFormatSHA256 ObjectFormatName = "sha256"
)
// Permission represents a set of permissions
type Permission struct {
Admin bool `json:"admin"` // Admin indicates if the user is an administrator of the repository.
@@ -104,23 +113,26 @@ type Repository struct {
AllowRebaseMerge bool `json:"allow_rebase_explicit"`
AllowSquash bool `json:"allow_squash_merge"`
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge"`
AllowMergeUpdate bool `json:"allow_merge_update"`
AllowRebaseUpdate bool `json:"allow_rebase_update"`
AllowManualMerge bool `json:"allow_manual_merge"`
AutodetectManualMerge bool `json:"autodetect_manual_merge"`
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge"`
DefaultMergeStyle string `json:"default_merge_style"`
DefaultUpdateStyle string `json:"default_update_style"`
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit"`
AvatarURL string `json:"avatar_url"`
Internal bool `json:"internal"`
MirrorInterval string `json:"mirror_interval"`
// ObjectFormatName of the underlying git repository
// enum: ["sha1","sha256"]
ObjectFormatName string `json:"object_format_name"`
ObjectFormatName ObjectFormatName `json:"object_format_name"`
// swagger:strfmt date-time
MirrorUpdated time.Time `json:"mirror_updated"`
RepoTransfer *RepoTransfer `json:"repo_transfer,omitempty"`
Topics []string `json:"topics"`
Licenses []string `json:"licenses"`
MirrorUpdated time.Time `json:"mirror_updated"`
// swagger:strfmt date-time
MirrorLastSyncAt time.Time `json:"mirror_last_sync_at"`
RepoTransfer *RepoTransfer `json:"repo_transfer,omitempty"`
Topics []string `json:"topics"`
Licenses []string `json:"licenses"`
}
// CreateRepoOption options when creating repository
@@ -142,7 +154,7 @@ type CreateRepoOption struct {
// Whether the repository is template
Template bool `json:"template"`
// Gitignores to use
Gitignores string `json:"gitignores"`
Gitignores string `json:"gitignores" binding:"MaxSize(1024)"`
// License to use
License string `json:"license" binding:"MaxSize(100)"`
// Readme of the repository to create
@@ -153,8 +165,7 @@ type CreateRepoOption struct {
// enum: ["default","collaborator","committer","collaboratorcommitter"]
TrustModel string `json:"trust_model"`
// ObjectFormatName of the underlying git repository, empty string for default (sha1)
// enum: ["sha1","sha256"]
ObjectFormatName string `json:"object_format_name" binding:"MaxSize(6)"`
ObjectFormatName ObjectFormatName `json:"object_format_name" binding:"MaxSize(6)"`
}
// EditRepoOption options when editing a repository's properties
@@ -215,12 +226,16 @@ type EditRepoOption struct {
AllowManualMerge *bool `json:"allow_manual_merge,omitempty"`
// either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
AutodetectManualMerge *bool `json:"autodetect_manual_merge,omitempty"`
// either `true` to allow updating pull request branch by merge, or `false` to prevent it.
AllowMergeUpdate *bool `json:"allow_merge_update,omitempty"`
// either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
AllowRebaseUpdate *bool `json:"allow_rebase_update,omitempty"`
// set to `true` to delete pr branch after merge by default
DefaultDeleteBranchAfterMerge *bool `json:"default_delete_branch_after_merge,omitempty"`
// set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", "squash", or "fast-forward-only".
DefaultMergeStyle *string `json:"default_merge_style,omitempty"`
// set to an update style to be used by this repository: "merge" or "rebase".
DefaultUpdateStyle *string `json:"default_update_style,omitempty"`
// set to `true` to allow edits from maintainers by default
DefaultAllowMaintainerEdit *bool `json:"default_allow_maintainer_edit,omitempty"`
// set to `true` to archive this repository.
@@ -229,6 +244,12 @@ type EditRepoOption struct {
MirrorInterval *string `json:"mirror_interval,omitempty"`
// enable prune - remove obsolete remote-tracking references when mirroring
EnablePrune *bool `json:"enable_prune,omitempty"`
// authentication username for the remote repository (mirrors)
MirrorUsername *string `json:"mirror_username,omitempty"`
// authentication password for the remote repository (mirrors)
MirrorPassword *string `json:"mirror_password,omitempty"`
// authentication token for the remote repository (mirrors)
MirrorToken *string `json:"mirror_token,omitempty"`
}
// GenerateRepoOption options when creating a repository using a template
@@ -105,29 +105,60 @@ type ActionArtifact struct {
// ActionWorkflowRun represents a WorkflowRun
type ActionWorkflowRun struct {
ID int64 `json:"id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
DisplayTitle string `json:"display_title"`
Path string `json:"path"`
Event string `json:"event"`
RunAttempt int64 `json:"run_attempt"`
RunNumber int64 `json:"run_number"`
RepositoryID int64 `json:"repository_id,omitempty"`
HeadSha string `json:"head_sha"`
HeadBranch string `json:"head_branch,omitempty"`
Status string `json:"status"`
Actor *User `json:"actor,omitempty"`
TriggerActor *User `json:"trigger_actor,omitempty"`
Repository *Repository `json:"repository,omitempty"`
HeadRepository *Repository `json:"head_repository,omitempty"`
Conclusion string `json:"conclusion,omitempty"`
ID int64 `json:"id"`
URL string `json:"url"`
// PreviousAttemptURL is the API URL of the previous attempt of this run, e.g. ".../actions/runs/{run_id}/attempts/{attempt-1}".
// It is set only when the current attempt is > 1 (i.e. a rerun). For the first attempt, or for legacy runs that pre-date ActionRunAttempt, it is null.
PreviousAttemptURL *string `json:"previous_attempt_url"`
HTMLURL string `json:"html_url"`
DisplayTitle string `json:"display_title"`
Path string `json:"path"`
Event string `json:"event"`
// RunAttempt is 1-based for runs created after ActionRunAttempt was introduced.
// A value of 0 is a legacy-only sentinel for runs created before attempts existed
// and indicates no corresponding /attempts/{n} resource is available.
RunAttempt int64 `json:"run_attempt"`
RunNumber int64 `json:"run_number"`
RepositoryID int64 `json:"repository_id,omitempty"`
HeadSha string `json:"head_sha"`
HeadBranch string `json:"head_branch,omitempty"`
Status string `json:"status"`
Actor *User `json:"actor,omitempty"`
TriggerActor *User `json:"trigger_actor,omitempty"`
Repository *Repository `json:"repository,omitempty"`
HeadRepository *Repository `json:"head_repository,omitempty"`
Conclusion string `json:"conclusion,omitempty"`
PullRequests []*PullRequestMinimal `json:"pull_requests"`
// swagger:strfmt date-time
StartedAt time.Time `json:"started_at"`
// swagger:strfmt date-time
CompletedAt time.Time `json:"completed_at"`
}
// PullRequestMinimal is the minimal information about a pull request, as
// returned in the `pull_requests` field of a workflow run.
type PullRequestMinimal struct {
ID int64 `json:"id"`
Number int64 `json:"number"`
URL string `json:"url"`
Head PullRequestMinimalHead `json:"head"`
Base PullRequestMinimalHead `json:"base"`
}
// PullRequestMinimalHead is a minimal description of one side of a pull request.
type PullRequestMinimalHead struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Repo PullRequestMinimalHeadRepo `json:"repo"`
}
// PullRequestMinimalHeadRepo is a minimal description of the repository on one side of a pull request.
type PullRequestMinimalHeadRepo struct {
ID int64 `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
}
// ActionWorkflowRunsResponse returns ActionWorkflowRuns
type ActionWorkflowRunsResponse struct {
Entries []*ActionWorkflowRun `json:"workflow_runs"`
@@ -50,6 +50,9 @@ type BranchProtection struct {
EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
EnableBypassAllowlist bool `json:"enable_bypass_allowlist"`
BypassAllowlistUsernames []string `json:"bypass_allowlist_usernames"`
BypassAllowlistTeams []string `json:"bypass_allowlist_teams"`
EnableStatusCheck bool `json:"enable_status_check"`
StatusCheckContexts []string `json:"status_check_contexts"`
RequiredApprovals int64 `json:"required_approvals"`
@@ -90,6 +93,9 @@ type CreateBranchProtectionOption struct {
EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
EnableBypassAllowlist bool `json:"enable_bypass_allowlist"`
BypassAllowlistUsernames []string `json:"bypass_allowlist_usernames"`
BypassAllowlistTeams []string `json:"bypass_allowlist_teams"`
EnableStatusCheck bool `json:"enable_status_check"`
StatusCheckContexts []string `json:"status_check_contexts"`
RequiredApprovals int64 `json:"required_approvals"`
@@ -123,6 +129,9 @@ type EditBranchProtectionOption struct {
EnableMergeWhitelist *bool `json:"enable_merge_whitelist"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
EnableBypassAllowlist *bool `json:"enable_bypass_allowlist"`
BypassAllowlistUsernames []string `json:"bypass_allowlist_usernames"`
BypassAllowlistTeams []string `json:"bypass_allowlist_teams"`
EnableStatusCheck *bool `json:"enable_status_check"`
StatusCheckContexts []string `json:"status_check_contexts"`
RequiredApprovals *int64 `json:"required_approvals"`
@@ -3,17 +3,41 @@
package structs
// RepoWritePermission is a permission level callers may grant to a team or
// collaborator on input. Output fields use AccessLevelName instead.
// swagger:enum RepoWritePermission
type RepoWritePermission string
const (
RepoWritePermissionRead RepoWritePermission = "read"
RepoWritePermissionWrite RepoWritePermission = "write"
RepoWritePermissionAdmin RepoWritePermission = "admin"
)
// AccessLevelName is the string rendering of a perm.AccessMode produced on
// API responses. Callers must not send these values; use RepoWritePermission
// on input.
// swagger:enum AccessLevelName
type AccessLevelName string
const (
AccessLevelNameNone AccessLevelName = "none"
AccessLevelNameRead AccessLevelName = "read"
AccessLevelNameWrite AccessLevelName = "write"
AccessLevelNameAdmin AccessLevelName = "admin"
AccessLevelNameOwner AccessLevelName = "owner"
)
// AddCollaboratorOption options when adding a user as a collaborator of a repository
type AddCollaboratorOption struct {
// enum: ["read","write","admin"]
// Permission level to grant the collaborator
Permission *string `json:"permission"`
Permission *RepoWritePermission `json:"permission"`
}
// RepoCollaboratorPermission to get repository permission for a collaborator
type RepoCollaboratorPermission struct {
// Permission level of the collaborator
Permission string `json:"permission"`
Permission AccessLevelName `json:"permission"`
// RoleName is the name of the permission role
RoleName string `json:"role_name"`
// User information of the collaborator
@@ -32,3 +32,8 @@ type RepoTopicOptions struct {
// list of topic names
Topics []string `json:"topics"`
}
// TopicListResponse returns a list of TopicResponse
type TopicListResponse struct {
Topics []*TopicResponse `json:"topics"`
}
@@ -6,7 +6,7 @@ package structs
import (
"time"
"code.gitea.io/gitea/modules/commitstatus"
"gitea.dev/modules/commitstatus"
)
// CommitStatus holds a single status of a single Commit
@@ -0,0 +1,31 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
import "time"
// CurrentAccessToken represents the metadata of the currently authenticated token.
// swagger:model CurrentAccessToken
type CurrentAccessToken struct {
// The unique identifier of the access token
ID int64 `json:"id"`
// The name of the access token
Name string `json:"name"`
// The scopes granted to this access token
Scopes []string `json:"scopes"`
// The timestamp when the token was created
CreatedAt time.Time `json:"created_at"`
// The timestamp when the token was last used
LastUsedAt time.Time `json:"last_used_at"`
// The owner of the access token
User *UserMeta `json:"user"`
}
// UserMeta represents minimal user information for the token owner.
type UserMeta struct {
// The unique identifier of the user
ID int64 `json:"id"`
// The username of the user
Login string `json:"login"`
}
+2 -3
View File
@@ -7,7 +7,7 @@ package structs
import (
"time"
"code.gitea.io/gitea/modules/json"
"gitea.dev/modules/json"
)
// User represents a user
@@ -18,7 +18,6 @@ type User struct {
// login of the user, same as `username`
UserName string `json:"login"`
// identifier of the user, provided by the external authenticator (if configured)
// default: empty
LoginName string `json:"login_name"`
// The ID of the user's Authentication Source
SourceID int64 `json:"source_id"`
@@ -51,7 +50,7 @@ type User struct {
// the user's description
Description string `json:"description"`
// User visibility level option: public, limited, private
Visibility string `json:"visibility"`
Visibility UserVisibility `json:"visibility"`
// user counts
Followers int `json:"followers_count"`
@@ -56,3 +56,14 @@ func ExtractKeysFromMapString(in map[string]VisibleType) (keys []string) {
}
return keys
}
// UserVisibility defines the visibility level of a user or organization as
// rendered in API payloads. The DB representation is VisibleType (int).
// swagger:enum UserVisibility
type UserVisibility string
const (
UserVisibilityPublic UserVisibility = "public"
UserVisibilityLimited UserVisibility = "limited"
UserVisibilityPrivate UserVisibility = "private"
)