Skip to content

Conversation

@tim-goto
Copy link

@tim-goto tim-goto commented Nov 7, 2025

BREAKING CHANGE: AttachCodeSecurityConfigurationsToRepositories is now AttachCodeSecurityConfigurationToRepositories.

please let me know if I should drop the commit with breaking changes and what you think about the other commits

@google-cla
Copy link

google-cla bot commented Nov 7, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gmlewis gmlewis changed the title feat: add enterprise security configurations, update api fields feat: Add enterprise security configurations, update API fields Nov 7, 2025
@tim-goto
Copy link
Author

tim-goto commented Nov 7, 2025

sorry forgot to add the generated files after my latest change..

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Nov 7, 2025
@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.32%. Comparing base (8760289) to head (a35e7aa).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3812      +/-   ##
==========================================
+ Coverage   92.27%   92.32%   +0.05%     
==========================================
  Files         192      193       +1     
  Lines       13896    13988      +92     
==========================================
+ Hits        12823    12915      +92     
  Misses        884      884              
  Partials      189      189              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis changed the title feat: Add enterprise security configurations, update API fields feat!: Add enterprise security configurations, update API fields Nov 7, 2025
@gmlewis gmlewis added the Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). label Nov 7, 2025
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please let me know if I should drop the commit with breaking changes and what you think about the other commits

I think that is fine, thanks. Please address the few minor suggestions I've made, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29

// GitHub API docs: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration-for-an-enterprise
//
//meta:operation POST /enterprises/{enterprise}/code-security/configurations
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should be a separate struct (fields name and description are required):

Suggested change
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, config CreateCodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
type CreateCodeSecurityConfiguration struct {
	Name string `json:"name"`
	Desription string `json:"description"`
	// all other optional fields
}

// GitHub API docs: https://docs.github.com/rest/code-security/configurations#update-a-custom-code-security-configuration-for-an-enterprise
//
//meta:operation PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id}
func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, id int64, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, id int64, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, id int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {

}

// AttachCodeSecurityConfigurationToRepositories attaches an enterprise code security configuration to repositories.
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//
// `scope` is the type of repositories to attach the configuration to.
// Can be one of: `all`, `all_without_configurations`.
//

}

// SetDefaultCodeSecurityConfiguration sets a code security configuration as a default for an enterprise.
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//
// `defaultForNewRepos` specifies which types of repository this security configuration should be applied to by default.
// Can be one of: `all`, `none`, `private_and_internal, public`.
//

// GitHub API docs: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-enterprise
//
//meta:operation PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults
func (s *EnterpriseService) SetDefaultCodeSecurityConfiguration(ctx context.Context, enterprise string, id int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *EnterpriseService) SetDefaultCodeSecurityConfiguration(ctx context.Context, enterprise string, id int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) {
func (s *EnterpriseService) SetDefaultCodeSecurityConfiguration(ctx context.Context, enterprise string, id int64, defaultForNewRepos string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) {

// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-enterprise
//
//meta:operation GET /enterprises/{enterprise}/code-security/configurations
func (s *EnterpriseService) GetCodeSecurityConfigurations(ctx context.Context, enterprise string) ([]*CodeSecurityConfiguration, *Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add query options according to the doc:

Image

// GitHub API docs: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration-for-an-enterprise
//
//meta:operation POST /enterprises/{enterprise}/code-security/configurations
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should be a separate struct (fields name and description are required):

Suggested change
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, config CreateCodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) {
type CreateCodeSecurityConfiguration struct {
	Name string `json:"name"`
	Desription string `json:"description"`
	// all other optional fields
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants