Schedule icon
OutputValues icon
Search icon
Loop icon
Request icon
Queries icon
If icon
Comment icon
Set icon
Log icon
DiscordIncomingWebhook icon
PurgeCurrentExecutionFiles icon

Weekly GitHub PR Review-Latency Digest with Reminders on Overdue PRs

Weekly GitHub review-latency digest with Kestra. p50/p90 time to first review and merge, per-label view, one reminder per overdue PR.

Categories
Infrastructure

"Are reviews getting slower?" is hard to answer from the pull request list. This flow answers it once a week for one repository: for the pull requests merged in the window it measures time to first review and time to merge (p50 and p90, overall and for the busiest labels), compares them with last week, and finds open pull requests that have waited longer than your review target without any review. Each of those gets one reminder comment, and the digest goes to Discord. Numbers are repository-level and per-label only, never per person.

How it works

  1. The weekly Schedule (Monday 08:00 UTC, shipped disabled) or a manual run starts the flow.
  2. Two github.pulls.Search tasks list the pull requests merged in the window and the open, non-draft ones with no review yet (review:none).
  3. first_reviews loops over the merged pull requests, eight at a time, reads each one's reviews with http.Request and keeps the earliest review not by the author or a bot.
  4. latency_stats (jdbc.duckdb.Queries) computes the percentiles, per-label medians and the overdue list. A review submitted after the merge does not count.
  5. plan keeps the overdue pull requests not already in the KV nudged list, oldest first, up to max_comments. With post_comments on, issues.Comment posts one reminder on each and the list is saved to KV after the comments succeed; with it off, the flow only logs which ones it would comment on.
  6. notify sends the digest to Discord and save_week stores the numbers in KV for next week. A failure sends the first error to Discord; finally purges the execution's files.

What you get

  • A weekly digest: p50 and p90 time to first review and to merge with last week's p50, pull requests merged without a review, the overdue count, the busiest labels and the longest waits.
  • One reminder per overdue pull request, never repeated across runs; it leaves the KV list once reviewed, merged, closed or back to draft.
  • A read-only first run: comments stay off until you turn them on.
  • Flow outputs summary and overdue, and a Discord alert when the run fails.

Who it's for

  • Open source maintainers who want contributors to hear back within a known time.
  • Engineering and platform leads tracking review flow for a repository without ranking people.

Why orchestrate this with Kestra

  • Native GitHub, DuckDB, KV and Discord tasks instead of a script: every step has its own outputs and logs, and the review calls retry with backoff.
  • KV holds the weekly numbers and the nudged list, so re-runs never comment twice.

Prerequisites

  • Kestra 2.0 with the GitHub, DuckDB (JDBC) and Discord plugins.
  • A GitHub token that can read pull requests on the repository; posting comments needs write access to pull requests (fine-grained token: Pull requests read and write).

Secrets

  • GITHUB_TOKEN: searches pull requests, reads reviews and posts the reminder comments.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook for the digest and the failure alert.

Quick start

  1. Add the two secrets to the namespace.
  2. Execute with your repository and the defaults (7 days, 48 hour target, comments off). Check the digest in Discord and the dry_run log line.
  3. Execute with post_comments: true once the list looks right, then set that default and enable the weekly trigger.

How to extend

  • Post to Slack instead: swap notify and alert_failure for io.kestra.plugin.slack.notifications.SlackIncomingWebhook with the same text as messageText.
  • Cover several repositories from a parent flow that loops over them and calls this one as a Subflow.
  • Open an issue with github.issues.Create when p90 time to first review doubles week over week.
  • Measure from "ready for review" instead of creation by reading the pull request timeline events.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.