Skip to content

Conversation

@vedantthapa
Copy link
Contributor

Propagate integrations instead of repository_roles, the repository_roles being propagated down to integrations causes an Invalid value error when defining rulesets. Excerpt from the failed CI job -

  │ Error: Invalid value for input variable
  │ 
  │   on ../repository_base/rulesets.tf line 83, in module "ruleset":83:   bypass_actors = {
  │   84:     repository_roles = [for bypasser in try(toset(coalesce(each.value.bypass_actors.repository_roles, [])), []) : {
  │   85:       role_id       = lookup(local.github_base_role_ids, bypasser.role, data.github_organization_custom_role.branch_ruleset_bypasser[bypasser.role].id)
  │   86:       always_bypass = bypasser.always_bypass
  │   87:     }]
  │   88:     teams = [for bypasser in try(toset(coalesce(each.value.bypass_actors.teams, [])), []) : {
  │   89:       team_id       = data.github_team.branch_ruleset_bypasser[bypasser.team].id
  │   90:       always_bypass = bypasser.always_bypass
  │   91:     }]
  │   92:     organization_admins = [for bypasser in try(toset(coalesce(each.value.bypass_actors.organization_admins, [])), []) : {
  │   93:       user_id       = data.github_user.branch_ruleset_bypasser[bypasser.user].id
  │   94:       always_bypass = bypasser.always_bypass
  │   95:     }]
  │   96:     integrations = try(each.value.bypass_actors.repository_roles, [])
  │   97:   }
  │ 
  │ The given value is not suitable for
  │ module.private_repositories["litellm-admin"].module.repository_base.module.ruleset["protected_branches"].var.bypass_actors
  │ declared at ../ruleset/variables.tf:6,1-25: attribute "integrations":
  │ incorrect list element type: attribute "installation_id" is required.

@gemini-code-assist
Copy link

Summary of Changes

Hello @vedantthapa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical configuration issue within the Terraform ruleset definitions. Previously, an Invalid value error would occur because the repository_roles were mistakenly being passed to the integrations field in the bypass_actors block. The change ensures that the correct integrations values are now propagated, resolving the error and allowing rulesets to be defined successfully.

Highlights

  • Bug Fix: Resolved an Invalid value error encountered during the definition of rulesets, which was caused by incorrect propagation of bypass_actors.
  • Configuration Correction: Updated the rulesets.tf module to correctly propagate integrations instead of repository_roles to the integrations field within the bypass_actors block, aligning with expected input types.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a bug where repository_roles were being propagated as integrations for repository rulesets, leading to a Terraform error. The change to use each.value.bypass_actors.integrations is correct and resolves the issue described in the CI failure.

While the fix is correct, I'd like to point out that the pattern for handling other optional bypass_actors like teams and repository_roles appears to be susceptible to errors if each.value.bypass_actors is null. The pattern used in this fix, try(each.value.bypass_actors.integrations, []), is more robust. It would be beneficial to create a follow-up PR to apply this safer pattern consistently across all bypass actor types. Additionally, enhancing modules/repository_base/rulesets.tftest.hcl with a test case covering bypass_actors would help prevent such regressions.

@vedantthapa
Copy link
Contributor Author

While the fix is correct, I'd like to point out that the pattern for handling other optional bypass_actors like teams and repository_roles appears to be susceptible to errors if each.value.bypass_actors is null. The pattern used in this fix, try(each.value.bypass_actors.integrations, []), is more robust.

Every other argument (teams, repository_role, organization_admins) is wrapped in a try function, so a null should end up translating to [].

@vedantthapa vedantthapa merged commit 1cc275f into main Oct 2, 2025
3 checks passed
@vedantthapa vedantthapa deleted the fix-integrations branch October 2, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants