fix: send a team's permission before its units (Gitea 28), hidden private-org team reviews, long non-ASCII repo descriptions, -R NAME vs directory guard, flake fallback

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-18 21:30:21 +02:00
1 parent 33f3ff10b6
commit 757b5fa1b9
12 files changed
+150 -8

No files matched your search

+20 -1
View File
@@ -6,6 +6,7 @@ package services
import (
"context"
"errors"
"fmt"
"net/http"
"slices"
"strconv"
@@ -238,6 +239,13 @@ func (s Repositories) Create(ctx context.Context, org string, opts RepositoryOpt
Readme: opts.Readme, DefaultBranch: opts.DefaultBranch, TrustModel: gitea.TrustModel(opts.TrustModel),
ObjectFormatName: opts.ObjectFormat,
}
// TODO(sdk): CreateRepoOption.Validate counts the description in bytes, but Gitea allows 2048
// characters; a longer one is set by an edit once the repository exists.
description := opts.Description
later := len(description) > sdkDescriptionLimit
if later {
options.Description = ""
}
item, _, err := call(ctx, s.Client, func(ctx context.Context, c *gitea.Client) (*gitea.Repository, *gitea.Response, error) {
if org != "" {
return c.Repositories.CreateOrgRepo(ctx, org, options)
@@ -251,9 +259,20 @@ func (s Repositories) Create(ctx context.Context, org string, opts RepositoryOpt
}
return Repository{}, Classify(err, "repository", "", "")
}
return repositoryFrom(item), nil
created := repositoryFrom(item)
if later {
edited, err := s.Edit(ctx, created.FullName, RepositoryEdit{Description: &description})
if err != nil {
return created, fmt.Errorf("repository %s was created, but setting its description failed: %w", created.FullName, err)
}
return edited, nil
}
return created, nil
}
// sdkDescriptionLimit is the length in bytes that the SDK accepts for a new repository's description.
const sdkDescriptionLimit = 2048
// Edit updates only explicitly supplied resource fields.
func (s Repositories) Edit(ctx context.Context, repo string, opts RepositoryEdit) (Repository, error) {
var mergeStyle *gitea.MergeStyle