Skip to content
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

Add support in rulesets for including or excluding repos based on properties #3194

Merged
merged 7 commits into from
Jun 26, 2024

Conversation

claystation
Copy link
Contributor

Github recently introduced Repository Properties. Rulesets can include or exclude repositories based on these properties.
The PR implements those conditions.

According to Github API docs:
https://docs.github.com/en/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-ruleset

Changed comment on RulesetConditions struct to say either use Name, ID OR repo property. The docs have not been super clear on this but i assume so because when creating rulesets trough UI you can either select repositories based on name or on property.

Please let me know what you think!

@claystation claystation changed the title Repo property ruleset conditions Add support in rulesets for including or excluding repositories based on repo properties Jun 25, 2024
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.90%. Comparing base (2b8c7fa) to head (f594bc7).
Report is 74 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3194      +/-   ##
==========================================
- Coverage   97.72%   92.90%   -4.82%     
==========================================
  Files         153      171      +18     
  Lines       13390    11548    -1842     
==========================================
- Hits        13085    10729    -2356     
- Misses        215      726     +511     
- Partials       90       93       +3     

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

@gmlewis gmlewis changed the title Add support in rulesets for including or excluding repositories based on repo properties Add support in rulesets for including or excluding repos based on properties Jun 25, 2024
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Jun 25, 2024
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.

Thank you, @claystation !
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

Copy link
Contributor

@ysoldak ysoldak left a comment

Choose a reason for hiding this comment

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

LGTM

@claystation
Copy link
Contributor Author

@gmlewis i had to fix a small bug by removing omitempty from include and exclude directives in RulesetRepositoryPropertyConditionParameters struct. This is because the Github API requires them even when empty. Would you like to re-review?

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Jun 26, 2024
@gmlewis
Copy link
Collaborator

gmlewis commented Jun 26, 2024

Thank you, @ysoldak and @claystation !
LGTM.
Merging.

@gmlewis gmlewis merged commit 42ae4fe into google:master Jun 26, 2024
6 of 7 checks passed
@claystation claystation deleted the repo-property-ruleset-conditions branch June 27, 2024 14:52
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