-
Notifications
You must be signed in to change notification settings - Fork 1
feat: adds support for release-related policies #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,6 +54,7 @@ type SaturatedRepository struct { | |||||||||
| // RequiredStatusChecks maps branch name -> required status checks configuration | ||||||||||
| RequiredStatusChecks map[string]*github.RequiredStatusChecks `json:"required_status_checks"` | ||||||||||
| SBOM *github.SBOM `json:"sbom"` | ||||||||||
| LastRelease *github.RepositoryRelease `json:"last_release"` | ||||||||||
| OpenPullRequests []*github.PullRequest `json:"pull_requests"` | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -175,13 +176,20 @@ func (l *GithubReposPlugin) Eval(req *proto.EvalRequest, apiHelper runner.ApiHel | |||||||||
| Status: proto.ExecutionStatus_FAILURE, | ||||||||||
| }, err | ||||||||||
| } | ||||||||||
|
|
||||||||||
| release, err := l.FecthLatestRelease(ctx, repo) | ||||||||||
| if err != nil { | ||||||||||
| l.Logger.Error("error gathering latest release", "error", err) | ||||||||||
| return &proto.EvalResponse{ | ||||||||||
| Status: proto.ExecutionStatus_FAILURE, | ||||||||||
| }, err | ||||||||||
| } | ||||||||||
| data := &SaturatedRepository{ | ||||||||||
| Settings: repo, | ||||||||||
| Workflows: workflows, | ||||||||||
| WorkflowRuns: workflowRuns, | ||||||||||
| ProtectedBranches: branchNames, | ||||||||||
| RequiredStatusChecks: requiredChecks, | ||||||||||
| LastRelease: release, | ||||||||||
| SBOM: sbom, | ||||||||||
| OpenPullRequests: pullRequests, | ||||||||||
| } | ||||||||||
|
|
@@ -282,6 +290,23 @@ func (l *GithubReposPlugin) FetchRepositories(ctx context.Context, req *proto.Ev | |||||||||
| return repochan, errchan | ||||||||||
| } | ||||||||||
|
|
||||||||||
| func (l *GithubReposPlugin) FecthLatestRelease(ctx context.Context, repo *github.Repository) (*github.RepositoryRelease, error) { | ||||||||||
| owner := repo.GetOwner().GetLogin() | ||||||||||
| name := repo.GetName() | ||||||||||
|
|
||||||||||
| release, resp, err := l.githubClient.Repositories.GetLatestRelease(ctx, owner, name) | ||||||||||
|
||||||||||
| release, resp, err := l.githubClient.Repositories.GetLatestRelease(ctx, owner, name) | |
| func (l *GithubReposPlugin) GatherLatestRelease(ctx context.Context, repo *github.Repository) (*github.RepositoryRelease, error) { |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in function name: 'Fecth' should be 'Fetch'.
| release, resp, err := l.githubClient.Repositories.GetLatestRelease(ctx, owner, name) | |
| func (l *GithubReposPlugin) FetchLatestRelease(ctx context.Context, repo *github.Repository) (*github.RepositoryRelease, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in function name: 'Fecth' should be 'Fetch'.