add reviewer assigning

This commit is contained in:
2026-07-29 09:49:51 +02:00
parent a82f5e7e9f
commit 1d90e364ee
17 changed files with 1475 additions and 47 deletions

View File

@@ -164,6 +164,19 @@ func (c *CachedGitHubService) UpdatePullRequest(
return writer.UpdatePullRequest(ctx, pullRequestID, update)
}
func (c *CachedGitHubService) UpdatePullRequestPeople(
ctx context.Context,
owner, repo string,
number int,
update PullRequestPeopleUpdate,
) (PullRequestPeople, error) {
writer, ok := c.remote.(GitHubPullRequestPeopleWriteService)
if !ok {
return PullRequestPeople{}, errors.New("GitHub service does not support updating pull request people")
}
return writer.UpdatePullRequestPeople(ctx, owner, repo, number, update)
}
func (c *CachedGitHubService) SetPullRequestAutoMerge(
ctx context.Context, pullRequestID, expectedHeadOID, mergeMethod string, enabled bool,
) (*AutoMergeRequest, error) {
@@ -209,6 +222,29 @@ func (c *CachedGitHubService) ListBranches(
return nil, err
}
func (c *CachedGitHubService) ListRepositoryUsers(
ctx context.Context, owner, repo string,
) ([]RepositoryUser, error) {
service, ok := c.remote.(GitHubRepositoryPeopleService)
if !ok {
return nil, errors.New("GitHub service does not support listing repository users")
}
users, err := service.ListRepositoryUsers(ctx, owner, repo)
if err == nil {
_ = c.write(c.repositoryUsersKey(owner, repo), users)
return users, nil
}
var cached cacheEnvelope[[]RepositoryUser]
if _, cacheErr := c.read(c.repositoryUsersKey(owner, repo), &cached); cacheErr == nil {
c.health.set(HealthComponent{
Name: "repository user cache", Level: healthWarning,
Summary: "using cached repository users", Detail: err.Error(), UpdatedAt: time.Now(),
})
return cached.Value, nil
}
return nil, err
}
func (c *CachedGitHubService) EnrichPullRequest(
ctx context.Context, details PRDetails,
) PRDetailsEnrichment {
@@ -238,6 +274,10 @@ func (c *CachedGitHubService) branchesKey(owner, repo string) string {
return fmt.Sprintf("branches:%s/%s", owner, repo)
}
func (c *CachedGitHubService) repositoryUsersKey(owner, repo string) string {
return fmt.Sprintf("repository-users:%s/%s", owner, repo)
}
func (c *CachedGitHubService) file(key string) string {
sum := sha256.Sum256([]byte(key))
return filepath.Join(c.dir, hex.EncodeToString(sum[:])+".json")