Skip to content

Commit cf45a6a

Browse files
committed
fix: add organization id to repository_dependabot_alert
1 parent cc1798d commit cf45a6a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

discovery/describers/repository_dependabot_alert.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ func GetAllRepositoriesDependabotAlerts(ctx context.Context, githubClient model.
1818
repositoryName = value.(string)
1919
}
2020

21+
organization, err := GetOrganizationAdditionalData(ctx, githubClient.RestClient, organizationName)
22+
if err != nil {
23+
return nil, err
24+
}
25+
2126
if repositoryName != "" {
22-
repoValues, err := GetRepositoryDependabotAlerts(ctx, githubClient, stream, organizationName, repositoryName)
27+
repoValues, err := GetRepositoryDependabotAlerts(ctx, githubClient, stream, organizationName, repositoryName, organization.GetID())
2328
if err != nil {
2429
return nil, err
2530
}
@@ -32,7 +37,7 @@ func GetAllRepositoriesDependabotAlerts(ctx context.Context, githubClient model.
3237
}
3338
var values []models.Resource
3439
for _, repo := range repositories {
35-
repoValues, err := GetRepositoryDependabotAlerts(ctx, githubClient, stream, organizationName, repo.GetName())
40+
repoValues, err := GetRepositoryDependabotAlerts(ctx, githubClient, stream, organizationName, repo.GetName(), organization.GetID())
3641
if err != nil {
3742
return nil, err
3843
}
@@ -41,7 +46,7 @@ func GetAllRepositoriesDependabotAlerts(ctx context.Context, githubClient model.
4146
return values, nil
4247
}
4348

44-
func GetRepositoryDependabotAlerts(ctx context.Context, githubClient model.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
49+
func GetRepositoryDependabotAlerts(ctx context.Context, githubClient model.GitHubClient, stream *models.StreamSender, owner, repo string, orgId int64) ([]models.Resource, error) {
4550
client := githubClient.RestClient
4651
opt := &github.ListAlertsOptions{
4752
ListCursorOptions: github.ListCursorOptions{First: pageSize},
@@ -96,6 +101,7 @@ func GetRepositoryDependabotAlerts(ctx context.Context, githubClient model.GitHu
96101
DismissedComment: alert.GetDismissedComment(),
97102
FixedAt: alert.GetFixedAt(),
98103
Organization: owner,
104+
OrganizationID: orgId,
99105
RepositoryName: repo,
100106
},
101107
}

discovery/provider/model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ type RepoAlertDependabotDescription struct {
13251325
DismissedComment string
13261326
FixedAt github.Timestamp
13271327
Organization string
1328+
OrganizationID int64
13281329
RepositoryName string
13291330
}
13301331

0 commit comments

Comments
 (0)