-
Notifications
You must be signed in to change notification settings - Fork 195
feat(github): add default rulesets and installation #47
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
Conversation
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.
Hello @fmind, 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!
Summary of Changes
This pull request introduces default rulesets and installation for GitHub repositories. It adds a main.json
file containing the ruleset configuration, modifies the README.md
file to include a new install-rulesets
task, and updates the tasks/install.just
file to include the implementation for installing the GitHub rulesets using the GitHub API.
Highlights
- Ruleset Configuration: The pull request introduces a
main.json
file that defines a ruleset for themain
branch. This ruleset enforces several rules, including deletion restrictions, required linear history, pull request requirements (approvals, dismissal of stale reviews, merge methods), required status checks, and non-fast-forward merges. - Installation Task: The pull request adds a new
install-rulesets
task to thetasks/install.just
file. This task uses the GitHub API to create a ruleset for the repository based on the configuration inmain.json
. - README Update: The
README.md
file is updated to include the newinstall-rulesets
task in the list of available tasks.
Changelog
- .github/rulesets/main.json
- Added a new file containing the default ruleset configuration for the
main
branch. - The ruleset enforces deletion restrictions, required linear history, pull request requirements, required status checks, and non-fast-forward merges.
- Bypass actors are configured to allow repository roles to bypass the rules.
- Added a new file containing the default ruleset configuration for the
- README.md
- Added
install-rulesets
to the list of available tasks.
- Added
- tasks/install.just
- Added a new
install-rulesets
task that uses the GitHub API to create a ruleset for the repository. - The task retrieves the repository name and owner using the
gh
CLI. - The task sends a POST request to the GitHub API to create the ruleset using the configuration in
.github/rulesets/main.json
.
- Added a new
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 is currently in preview and 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 to provide feedback.
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.
Trivia time!
What is the purpose of the 'jq' command-line tool used in the install-rulesets
task?
Click here for the answer
The `jq` command-line tool is a lightweight and flexible JSON processor. It is used to slice, filter, map and transform structured data.
Footnotes
-
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. ↩
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.
Code Review
This pull request introduces default rulesets and installation for GitHub repositories using just
. The changes look good overall, but there are a few areas that could be improved for clarity and maintainability.
Summary of Findings
- Error Handling in
install-rulesets
: Theinstall-rulesets
task intasks/install.just
usesset -euo pipefail
, which is good for general error handling. However, it might be beneficial to add specific error handling around thegh api
call to provide more informative error messages or retry logic if the API call fails. I did not add a review comment for this due to the review settings. - Clarity of Rule Set Purpose: The
main.json
ruleset lacks comments explaining the purpose of each rule. Adding comments would improve readability and maintainability. I did not add a review comment for this due to the review settings.
Merge Readiness
The pull request is almost ready for merging. Addressing the suggested improvements, particularly regarding error handling and documentation, would enhance the quality and maintainability of the code. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging.
gh api --method POST -H "Accept: application/vnd.github+json" \ | ||
"/repos/$owner/$repo/rulesets" --input=".github/rulesets/main.json" |
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.
Consider adding a comment explaining what this command does, and what the expected output is. This will help future developers understand the purpose of this command.
gh api --method POST -H "Accept: application/vnd.github+json" \
"/repos/$owner/$repo/rulesets" --input=".github/rulesets/main.json" # Creates or updates the ruleset for the repository
Closes by #46 |
Changes
Reasons
Testing
Impacts
Notes