Skip to content

Commit 3bfad51

Browse files
committed
feat(repos): add manifest parser and validation for repos.yaml
Signed-off-by: Greg Allen <gallen@redhat.com> Signed-off-by: Claude <noreply@anthropic.com> Signed-off-by: Greg Allen <gallen@redhat.com>
1 parent 6cfeae9 commit 3bfad51

3 files changed

Lines changed: 1600 additions & 2 deletions

File tree

internal/forge/fake.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type FakeClient struct {
111111

112112
// Pre-populated data
113113
Repos []Repository
114+
OrgRepos map[string][]Repository // per-org repos; when set, ListOrgRepos uses this instead of Repos
114115
FileContents map[string][]byte // key: "owner/repo/path"
115116
WorkflowRuns map[string]*WorkflowRun // key: "owner/repo/workflow"
116117
Workflows map[string]*Workflow // key: "owner/repo/workflow"
@@ -229,16 +230,21 @@ func (f *FakeClient) err(method string) error {
229230
return f.Errors[method]
230231
}
231232

232-
func (f *FakeClient) ListOrgRepos(_ context.Context, _ string) ([]Repository, error) {
233+
func (f *FakeClient) ListOrgRepos(_ context.Context, org string) ([]Repository, error) {
233234
f.mu.Lock()
234235
defer f.mu.Unlock()
235236

236237
if e := f.err("ListOrgRepos"); e != nil {
237238
return nil, e
238239
}
239240

241+
source := f.Repos
242+
if f.OrgRepos != nil {
243+
source = f.OrgRepos[org]
244+
}
245+
240246
var result []Repository
241-
for _, r := range f.Repos {
247+
for _, r := range source {
242248
if r.Archived || r.Fork || r.Private {
243249
continue
244250
}

0 commit comments

Comments
 (0)