Skip to content

Conversation

@vedantthapa
Copy link
Contributor

@vedantthapa vedantthapa commented Oct 6, 2025

Duplicate of #64, minus the 250ea32 commit.

The condition inside validation block can only refer to the variable itself (See failed run) -

  ╷
  │ Error: Invalid reference in variable validation
  │ 
  │   on ../ruleset/variables.tf line 11, in variable "repository":11:     condition     = var.ruleset_type != "repository" || var.repository != null
  │ 
  │ The condition for variable "repository" can only refer to the variable
  │ itself, using var.repository.

There's a PR upstream to make the repository argument required in the provider. Plus, the repository name is passed via an github_repository.repository.name implicit dependency in the repository_base module, so it's safe to expect that field to be present.

Relates to #65

@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 introduces a dedicated repository argument to the GitHub ruleset Terraform module. This change is crucial for correctly applying repository-specific rulesets, resolving a previous Terraform validation constraint, and proactively adapting to an upcoming requirement in the upstream GitHub Terraform provider. It streamlines the process of associating rulesets with their target repositories.

Highlights

  • New repository argument: Introduced a repository input variable in the ruleset module to explicitly specify the target repository for rulesets.
  • Terraform Validation Fix: Resolved a Terraform validation error where the repository variable's condition could not refer to other variables, ensuring correct usage when ruleset_type is 'repository'.
  • Upstream Alignment: This change aligns with an upcoming upstream modification in the terraform-provider-github that will make the repository argument a required field, future-proofing the module.
  • Implicit Dependency Integration: The repository argument is now implicitly passed from github_repository.repository.name within the repository_base module, ensuring its presence and correct association.
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 adds a repository argument to the ruleset module, which is necessary for creating repository-level rulesets. The changes are well-implemented across the module, examples, tests, and documentation. I have one suggestion to improve the module's robustness by adding explicit validation for the new repository argument.

@vedantthapa vedantthapa enabled auto-merge (squash) October 6, 2025 21:35
@vedantthapa vedantthapa merged commit d5c1a82 into main Oct 7, 2025
3 checks passed
@vedantthapa vedantthapa deleted the add-repository-name branch October 7, 2025 12:36
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