Repository navigation
feat(linear-ticket): gate protected branches only - #191
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-01a01d5b-2df4-75d3-8833-ff46b17b212b Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a01d5b-2df4-75d3-8833-ff46b17b212b Co-authored-by: Amp <amp@ampcode.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 58 minutes Limit details: You’ve used the included review currently available. Your 99 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Comment |
| def branch_is_protected(self, branch: str) -> bool | None: | ||
| encoded = urllib.parse.quote(branch, safe="") | ||
| data = self.get(f"/repos/{self.repo}/branches/{encoded}") | ||
| protected = (data or {}).get("protected") | ||
| return protected if isinstance(protected, bool) else None |
There was a problem hiding this comment.
not sure if this check is necessary? Can we instead have caller pass in the branch they want to check against?
There was a problem hiding this comment.
@huntcsg kept this dynamic intentionally: both ComfyUI and frontend may have more than one protected branch, and GitHub’s protected field covers classic branch protection and active rulesets using the caller’s existing contents: read permission. Passing one branch would miss additional protected release branches; passing a list would duplicate ruleset configuration in every caller and drift when protection changes. The runtime lookup keeps the repository settings as the source of truth.
There was a problem hiding this comment.
the intent was on repos like frontend I wanted it to just work.
luke-mino-altherr
left a comment
There was a problem hiding this comment.
Approved, but alternative implementation is to explicitly pass in the branch to check against in github action args. in our case, we'll likely always be checking against the protected main branch
Summary
Tests
python3 -m unittest discover -s scripts/linear-ticket/tests -p 'test_*.py' -vpython3 -m py_compile scripts/linear-ticket/lib.py scripts/linear-ticket/validate.py scripts/linear-ticket/tests/test_validate.py