Skip to content

feat(linear-ticket): gate protected branches only - #191

Merged
huntcsg merged 2 commits into
mainfrom
linear-issue-required-on-protected-branches
Aug 20, 2026
Merged

huntcsg merged 2 commits into
mainfrom
linear-issue-required-on-protected-branches

Conversation

@huntcsg

@huntcsg huntcsg commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enforce linked Linear tickets only for PRs targeting protected branches
  • support multiple branches protected by branch protection or rulesets
  • publish no shared status for unprotected targets to prevent SHA-scoped status bypasses
  • suppress stale results when a PR is retargeted

Tests

  • python3 -m unittest discover -s scripts/linear-ticket/tests -p 'test_*.py' -v
  • python3 -m py_compile scripts/linear-ticket/lib.py scripts/linear-ticket/validate.py scripts/linear-ticket/tests/test_validate.py

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

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.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3c38e2ef-7eff-477a-b4a0-0d2240a980d0

📥 Commits

Reviewing files that changed from the base of the PR and between b09780e and 1d769e3.

📒 Files selected for processing (6)
  • .github/workflows/linear-ticket.yml
  • README.md
  • docs/callers/linear-ticket.md
  • scripts/linear-ticket/README.md
  • scripts/linear-ticket/tests/test_validate.py
  • scripts/linear-ticket/validate.py

Comment @coderabbitai help to get the list of available commands.

Comment on lines +187 to +191
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure if this check is necessary? Can we instead have caller pass in the branch they want to check against?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the intent was on repos like frontend I wanted it to just work.

@luke-mino-altherr luke-mino-altherr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@huntcsg
huntcsg merged commit f75839f into main Aug 20, 2026
6 checks passed
@huntcsg
huntcsg deleted the linear-issue-required-on-protected-branches branch August 20, 2026 05:44
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