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

fix: update existing ruleset when in transition mode #1951

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

JoshuaKGoldberg
Copy link
Owner

PR Checklist

Overview

Previously, blockRepositoryBranchRuleset would always create a ruleset on main with the hardcoded name. This is fine for setup mode but crashes on a duplicate ID creation error in transition mode.

Now, its creations are split between the two modes:

  • Setup mode POST creates the ruleset as before
  • Transition mode PUT updates the existing ruleset

The PUT update requires a ruleset_id, so I added that as a new option in the Base populated by a new inputFromOctkit.

🎁

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 45 lines in your changes missing coverage. Please review.

Project coverage is 95.42%. Comparing base (211491b) to head (74ef283).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/blocks/blockRepositoryBranchRuleset.ts 48.75% 41 Missing ⚠️
src/base.ts 83.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1951      +/-   ##
==========================================
+ Coverage   95.40%   95.42%   +0.02%     
==========================================
  Files          86       87       +1     
  Lines        3522     3586      +64     
  Branches      201      205       +4     
==========================================
+ Hits         3360     3422      +62     
- Misses        162      164       +2     

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

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review March 4, 2025 15:56
@JoshuaKGoldberg JoshuaKGoldberg merged commit 778e5eb into main Mar 4, 2025
11 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the ruleset-id-updates branch March 4, 2025 15: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.

🐛 Bug: branch-ruleset API crashes if a ruleset already exists (transition mode)
1 participant