open-code-review/.github
Lei Zhang b196ee053c
ci(workflow): add rate-limit-aware retry for PR review comment posting (#183)
* ci(workflow): add rate-limit-aware retry for PR review comment posting

Add GitHub REST API rate-limit handling to the ocr-review workflow:

- Implement computeRetryDelayMs() following GitHub's documented strategy:
  * Honor retry-after header (seconds or HTTP-date)
  * Wait until x-ratelimit-reset when primary limit is exhausted (remaining=0)
  * Exponential backoff (>=60s base) for secondary limits without a header
  * Backoff for transient 5xx/408 errors
- Add per-comment retry loop with configurable attempts and delays
- Add logRateLimitQuota() to log and proactively throttle on low remaining quota
- Honor batch createReview rate-limit headers before per-comment retry
- Cap all waits (including header-derived) to avoid stalling the CI job
- Expose tuning via OCR_* env vars (retries, delays, thresholds)
- Update example workflow docs with retry/delay configuration reference

* fix(workflow): use shorter transient backoff base and dedupe header lookup

- Transient server errors (5xx/408) now use a 2s base delay instead of
  the 60s rate-limit base, matching the comment's stated intent and
  avoiding unnecessary CI stalls on short-lived server hiccups.
- Extract a shared getHeader() helper for case-insensitive header
  lookup, reused by both computeRetryDelayMs and logRateLimitQuota to
  eliminate duplicated logic and ensure consistent robustness.

* doc: revert example doc
2026-06-23 21:07:04 +08:00
..
ISSUE_TEMPLATE Add issue and PR templates with bilingual contributing guide (#9) 2026-05-30 14:22:50 +08:00
workflows ci(workflow): add rate-limit-aware retry for PR review comment posting (#183) 2026-06-23 21:07:04 +08:00
pull_request_template.md Add issue and PR templates with bilingual contributing guide (#9) 2026-05-30 14:22:50 +08:00
release.yml feat(release): auto-generate structured release notes from conventional commits 2026-06-22 15:52:06 +08:00