• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 24346603742

13 Apr 2026 01:41PM UTC coverage: 59.271% (-0.1%) from 59.39%
24346603742

Pull #6356

github

web-flow
Merge 26ed1fc3d into d37e0c296
Pull Request #6356: feat(entities): Implement ENTITY_ORGANIZATION for Github Providers

35 of 122 new or added lines in 8 files covered. (28.69%)

1 existing line in 1 file now uncovered.

19873 of 33529 relevant lines covered (59.27%)

35.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

39.39
/internal/providers/github/properties/fetcher.go
1
// SPDX-FileCopyrightText: Copyright 2024 The Minder Authors
2
// SPDX-License-Identifier: Apache-2.0
3

4
// Package properties provides utility functions for fetching and managing properties
5
package properties
6

7
import (
8
        "context"
9

10
        go_github "github.com/google/go-github/v63/github"
11

12
        minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
13
        "github.com/mindersec/minder/pkg/entities/properties"
14
)
15

16
// GhPropertyWrapper is a function that fetches a property from the GitHub API
17
type GhPropertyWrapper func(
18
        ctx context.Context, ghCli *go_github.Client, isOrg bool, lookupProperties *properties.Properties,
19
) (map[string]any, error)
20

21
// GhPropertyFetcher is an interface for fetching properties from the GitHub API
22
type GhPropertyFetcher interface {
23
        ghPropertyFetcherBase
24
        GetName(props *properties.Properties) (string, error)
25
}
26

27
type ghPropertyFetcherBase interface {
28
        WrapperForProperty(propertyKey string) GhPropertyWrapper
29
        AllPropertyWrappers() []GhPropertyWrapper
30
        OperationalProperties() []string
31
}
32

33
// GhPropertyFetcherFactory is an interface for creating GhPropertyFetcher instances
34
type GhPropertyFetcherFactory interface {
35
        EntityPropertyFetcher(entType minderv1.Entity) GhPropertyFetcher
36
}
37

38
type ghEntityFetcher struct{}
39

40
// NewPropertyFetcherFactory creates a new GhPropertyFetcherFactory
41
func NewPropertyFetcherFactory() GhPropertyFetcherFactory {
52✔
42
        return ghEntityFetcher{}
52✔
43
}
52✔
44

45
// EntityPropertyFetcher returns a GhPropertyFetcher for the given entity type
46
func (ghEntityFetcher) EntityPropertyFetcher(entType minderv1.Entity) GhPropertyFetcher {
16✔
47
        // nolint:exhaustive
16✔
48
        switch entType {
16✔
49
        case minderv1.Entity_ENTITY_PULL_REQUESTS:
2✔
50
                return NewPullRequestFetcher()
2✔
51
        case minderv1.Entity_ENTITY_REPOSITORIES:
×
52
                return NewRepositoryFetcher()
×
53
        case minderv1.Entity_ENTITY_ARTIFACTS:
2✔
54
                return NewArtifactFetcher()
2✔
55
        case minderv1.Entity_ENTITY_RELEASE:
2✔
56
                return NewReleaseFetcher()
2✔
NEW
57
        case minderv1.Entity_ENTITY_ORGANIZATION:
×
NEW
58
                return NewOrganizationFetcher()
×
59
        }
60

61
        return nil
10✔
62
}
63

64
type propertyOrigin struct {
65
        keys    []string
66
        wrapper GhPropertyWrapper
67
}
68

69
type propertyFetcherBase struct {
70
        propertyOrigins       []propertyOrigin
71
        operationalProperties []string
72
}
73

74
var _ ghPropertyFetcherBase = propertyFetcherBase{}
75

76
// WrapperForProperty returns the property wrapper for the given property key
77
func (pfb propertyFetcherBase) WrapperForProperty(propertyKey string) GhPropertyWrapper {
×
78
        for _, po := range pfb.propertyOrigins {
×
79
                for _, k := range po.keys {
×
80
                        if k == propertyKey {
×
81
                                return po.wrapper
×
82
                        }
×
83
                }
84
        }
85

86
        return nil
×
87
}
88

89
// AllPropertyWrappers returns all property wrappers for the repository
90
func (pfb propertyFetcherBase) AllPropertyWrappers() []GhPropertyWrapper {
×
91
        wrappers := make([]GhPropertyWrapper, 0, len(pfb.propertyOrigins))
×
92
        for _, po := range pfb.propertyOrigins {
×
93
                wrappers = append(wrappers, po.wrapper)
×
94
        }
×
95
        return wrappers
×
96
}
97

98
// OperationalProperties returns the operational properties for the repository
99
func (pfb propertyFetcherBase) OperationalProperties() []string {
×
100
        return pfb.operationalProperties
×
101
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc