@@ -563,124 +563,124 @@ func expandCodeSecurityConfiguration(d *schema.ResourceData) github.CodeSecurity
563563 }
564564
565565 // Only set optional fields if they are explicitly configured
566- if v , ok := d .GetOk ("advanced_security" ); ok {
567- config .AdvancedSecurity = github .Ptr (v .(string ))
566+ if val , ok := d .GetOk ("advanced_security" ); ok {
567+ config .AdvancedSecurity = github .Ptr (val .(string ))
568568 }
569569
570- if v , ok := d .GetOk ("dependency_graph" ); ok {
571- config .DependencyGraph = github .Ptr (v .(string ))
570+ if val , ok := d .GetOk ("dependency_graph" ); ok {
571+ config .DependencyGraph = github .Ptr (val .(string ))
572572 }
573573
574- if v , ok := d .GetOk ("dependency_graph_autosubmit_action" ); ok {
575- config .DependencyGraphAutosubmitAction = github .Ptr (v .(string ))
574+ if val , ok := d .GetOk ("dependency_graph_autosubmit_action" ); ok {
575+ config .DependencyGraphAutosubmitAction = github .Ptr (val .(string ))
576576 }
577577
578- if v , ok := d .GetOk ("dependabot_alerts" ); ok {
579- config .DependabotAlerts = github .Ptr (v .(string ))
578+ if val , ok := d .GetOk ("dependabot_alerts" ); ok {
579+ config .DependabotAlerts = github .Ptr (val .(string ))
580580 }
581581
582- if v , ok := d .GetOk ("dependabot_security_updates" ); ok {
583- config .DependabotSecurityUpdates = github .Ptr (v .(string ))
582+ if val , ok := d .GetOk ("dependabot_security_updates" ); ok {
583+ config .DependabotSecurityUpdates = github .Ptr (val .(string ))
584584 }
585585
586- if v , ok := d .GetOk ("code_scanning_default_setup" ); ok {
587- config .CodeScanningDefaultSetup = github .Ptr (v .(string ))
586+ if val , ok := d .GetOk ("code_scanning_default_setup" ); ok {
587+ config .CodeScanningDefaultSetup = github .Ptr (val .(string ))
588588 }
589589
590- if v , ok := d .GetOk ("code_scanning_delegated_alert_dismissal" ); ok {
591- config .CodeScanningDelegatedAlertDismissal = github .Ptr (v .(string ))
590+ if val , ok := d .GetOk ("code_scanning_delegated_alert_dismissal" ); ok {
591+ config .CodeScanningDelegatedAlertDismissal = github .Ptr (val .(string ))
592592 }
593593
594- if v , ok := d .GetOk ("code_security" ); ok {
595- config .CodeSecurity = github .Ptr (v .(string ))
594+ if val , ok := d .GetOk ("code_security" ); ok {
595+ config .CodeSecurity = github .Ptr (val .(string ))
596596 }
597597
598- if v , ok := d .GetOk ("secret_scanning" ); ok {
599- config .SecretScanning = github .Ptr (v .(string ))
598+ if val , ok := d .GetOk ("secret_scanning" ); ok {
599+ config .SecretScanning = github .Ptr (val .(string ))
600600 }
601601
602- if v , ok := d .GetOk ("secret_scanning_push_protection" ); ok {
603- config .SecretScanningPushProtection = github .Ptr (v .(string ))
602+ if val , ok := d .GetOk ("secret_scanning_push_protection" ); ok {
603+ config .SecretScanningPushProtection = github .Ptr (val .(string ))
604604 }
605605
606- if v , ok := d .GetOk ("secret_scanning_delegated_bypass" ); ok {
607- config .SecretScanningDelegatedBypass = github .Ptr (v .(string ))
606+ if val , ok := d .GetOk ("secret_scanning_delegated_bypass" ); ok {
607+ config .SecretScanningDelegatedBypass = github .Ptr (val .(string ))
608608 }
609609
610- if v , ok := d .GetOk ("secret_scanning_validity_checks" ); ok {
611- config .SecretScanningValidityChecks = github .Ptr (v .(string ))
610+ if val , ok := d .GetOk ("secret_scanning_validity_checks" ); ok {
611+ config .SecretScanningValidityChecks = github .Ptr (val .(string ))
612612 }
613613
614- if v , ok := d .GetOk ("secret_scanning_non_provider_patterns" ); ok {
615- config .SecretScanningNonProviderPatterns = github .Ptr (v .(string ))
614+ if val , ok := d .GetOk ("secret_scanning_non_provider_patterns" ); ok {
615+ config .SecretScanningNonProviderPatterns = github .Ptr (val .(string ))
616616 }
617617
618- if v , ok := d .GetOk ("secret_scanning_generic_secrets" ); ok {
619- config .SecretScanningGenericSecrets = github .Ptr (v .(string ))
618+ if val , ok := d .GetOk ("secret_scanning_generic_secrets" ); ok {
619+ config .SecretScanningGenericSecrets = github .Ptr (val .(string ))
620620 }
621621
622- if v , ok := d .GetOk ("secret_scanning_delegated_alert_dismissal" ); ok {
623- config .SecretScanningDelegatedAlertDismissal = github .Ptr (v .(string ))
622+ if val , ok := d .GetOk ("secret_scanning_delegated_alert_dismissal" ); ok {
623+ config .SecretScanningDelegatedAlertDismissal = github .Ptr (val .(string ))
624624 }
625625
626- if v , ok := d .GetOk ("secret_protection" ); ok {
627- config .SecretProtection = github .Ptr (v .(string ))
626+ if val , ok := d .GetOk ("secret_protection" ); ok {
627+ config .SecretProtection = github .Ptr (val .(string ))
628628 }
629629
630- if v , ok := d .GetOk ("private_vulnerability_reporting" ); ok {
631- config .PrivateVulnerabilityReporting = github .Ptr (v .(string ))
630+ if val , ok := d .GetOk ("private_vulnerability_reporting" ); ok {
631+ config .PrivateVulnerabilityReporting = github .Ptr (val .(string ))
632632 }
633633
634- if v , ok := d .GetOk ("enforcement" ); ok {
635- config .Enforcement = github .Ptr (v .(string ))
634+ if val , ok := d .GetOk ("enforcement" ); ok {
635+ config .Enforcement = github .Ptr (val .(string ))
636636 }
637637
638- if v , ok := d .GetOk ("dependency_graph_autosubmit_action_options" ); ok {
639- optionsList := v .([]any )
638+ if val , ok := d .GetOk ("dependency_graph_autosubmit_action_options" ); ok {
639+ optionsList := val .([]any )
640640 if len (optionsList ) > 0 {
641- m := optionsList [0 ].(map [string ]any )
641+ autosubmitOpts := optionsList [0 ].(map [string ]any )
642642 config .DependencyGraphAutosubmitActionOptions = & github.DependencyGraphAutosubmitActionOptions {
643- LabeledRunners : github .Ptr (m ["labeled_runners" ].(bool )),
643+ LabeledRunners : github .Ptr (autosubmitOpts ["labeled_runners" ].(bool )),
644644 }
645645 }
646646 }
647647
648- if v , ok := d .GetOk ("code_scanning_default_setup_options" ); ok {
649- optionsList := v .([]any )
648+ if val , ok := d .GetOk ("code_scanning_default_setup_options" ); ok {
649+ optionsList := val .([]any )
650650 if len (optionsList ) > 0 {
651- m := optionsList [0 ].(map [string ]any )
651+ setupOpts := optionsList [0 ].(map [string ]any )
652652 config .CodeScanningDefaultSetupOptions = & github.CodeScanningDefaultSetupOptions {
653- RunnerType : m ["runner_type" ].(string ),
653+ RunnerType : setupOpts ["runner_type" ].(string ),
654654 }
655- if runnerLabel , ok := m ["runner_label" ].(string ); ok && runnerLabel != "" {
655+ if runnerLabel , ok := setupOpts ["runner_label" ].(string ); ok && runnerLabel != "" {
656656 config .CodeScanningDefaultSetupOptions .RunnerLabel = github .Ptr (runnerLabel )
657657 }
658658 }
659659 }
660660
661- if v , ok := d .GetOk ("code_scanning_options" ); ok {
662- optionsList := v .([]any )
661+ if val , ok := d .GetOk ("code_scanning_options" ); ok {
662+ optionsList := val .([]any )
663663 if len (optionsList ) > 0 {
664- m := optionsList [0 ].(map [string ]any )
664+ scanOpts := optionsList [0 ].(map [string ]any )
665665 config .CodeScanningOptions = & github.CodeScanningOptions {
666- AllowAdvanced : github .Ptr (m ["allow_advanced" ].(bool )),
666+ AllowAdvanced : github .Ptr (scanOpts ["allow_advanced" ].(bool )),
667667 }
668668 }
669669 }
670670
671- if v , ok := d .GetOk ("secret_scanning_delegated_bypass_options" ); ok {
672- optionsList := v .([]any )
671+ if val , ok := d .GetOk ("secret_scanning_delegated_bypass_options" ); ok {
672+ optionsList := val .([]any )
673673 if len (optionsList ) > 0 {
674- m := optionsList [0 ].(map [string ]any )
674+ bypassOpts := optionsList [0 ].(map [string ]any )
675675 options := & github.SecretScanningDelegatedBypassOptions {}
676- if reviewersV , ok := m ["reviewers" ]; ok {
677- reviewersList := reviewersV .([]any )
676+ if reviewersVal , ok := bypassOpts ["reviewers" ]; ok {
677+ reviewersList := reviewersVal .([]any )
678678 reviewers := make ([]* github.BypassReviewer , 0 , len (reviewersList ))
679- for _ , rV := range reviewersList {
680- rM := rV .(map [string ]any )
679+ for _ , reviewerRaw := range reviewersList {
680+ reviewerMap := reviewerRaw .(map [string ]any )
681681 reviewers = append (reviewers , & github.BypassReviewer {
682- ReviewerID : int64 (rM ["reviewer_id" ].(int )),
683- ReviewerType : rM ["reviewer_type" ].(string ),
682+ ReviewerID : int64 (reviewerMap ["reviewer_id" ].(int )),
683+ ReviewerType : reviewerMap ["reviewer_type" ].(string ),
684684 })
685685 }
686686 options .Reviewers = reviewers
0 commit comments