On a schedule
Get a weekly pull request report per repo
Each Monday you see how many pull requests were opened, merged and declined in every repo last week, and by whom.
- Runs
- On a schedule
- Apps
- Bitbucket
- AI
- Not needed
- Access
- read:repository:bitbucket, read:pullrequest:bitbucket
Send this to your assistant
Create a ClickRuntime automation: every Monday at 9am, email me a table of last week's Bitbucket pull requests for each repo in the acme workspace: how many were opened, merged and declined, with the authors.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An engineering manager running three or four Bitbucket repositories usually answers the question of how the team is doing from gut feeling. Maybe one repo has stalled, maybe one person is carrying all the reviews, maybe a pile of declined pull requests means requirements keep changing. Nobody has time to open each repository on Monday morning and count by hand, so the pattern only shows up when a deadline slips.
Every Monday, ClickRuntime goes through the repositories in your workspace, reads recent pull requests newest-updated first and stops paging once it reaches ones last updated more than seven days ago. It then counts how many were opened, merged and declined in each repo and by each author, and emails the totals. Date filtering is done on the ClickRuntime side because Bitbucket's query filter on dates is not documented.
Team leads, directors and consultants who need a weekly engineering pulse without a metrics platform find it useful.
What you get out of it
Throughput you can compare week to week
Seeing merged counts per repository each Monday turns a vague feeling about velocity into numbers. A drop from twelve merges to three stands out immediately and prompts the right question.
Uneven workloads become visible
Per-author counts show who is opening and merging most of the work. A manager can spot an overloaded engineer or a quiet one before burnout or disengagement turns into a resignation.
Declined pull requests flag churn
A rising number of declined pull requests often means unclear specs or misaligned priorities. Catching that in a weekly count lets you fix the planning problem instead of blaming the code.
A lightweight record for status reports
The Monday email can be pasted straight into a stakeholder update or a sprint review. Nobody spends an hour gathering numbers for a meeting that needs only three of them.
No metrics tool to buy or maintain
Engineering analytics products take setup and a budget. A scheduled count over your own Bitbucket data gives the headline numbers with nothing extra to administer. Small teams especially benefit, because a count over data you already own costs nothing extra.
How it works
What happens, step by step
Every Monday at 9, ClickRuntime goes through each repository in your Bitbucket workspace.
It gathers the pull requests updated in the last seven days.
It counts how many were opened, merged and declined in each repository, and who wrote them.
The table arrives in your inbox.
Before it runs live
- Connect Bitbucket
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Bitbucket steps into one automation
Under the hood
The code that runs this automation
from collections import Counter
from datetime import datetime, timedelta, timezone
from clickruntime import on_trigger, credentials, http, notify
BB = "https://api.bitbucket.org/2.0"
def bb(path, **params):
resp = http.get(f"{BB}{path}", headers={"Authorization": f"Bearer {credentials.secret('BITBUCKET_TOKEN')}"}, params=params)
resp.raise_for_status()
return resp.json()
@on_trigger
def run(event):
cutoff = datetime.now(timezone.utc) - timedelta(days=7)
rows = ["repo | opened | merged | declined | authors"]
for repo in bb("/repositories/acme", pagelen=100)["values"]:
counts, authors = Counter(), set()
page = bb(f"/repositories/acme/{repo['slug']}/pullrequests", q='state="MERGED" OR state="DECLINED" OR state="OPEN"',
sort="-updated_on", pagelen=50)
for p in page["values"]:
if datetime.fromisoformat(p["updated_on"]) < cutoff:
break
counts["opened"] += datetime.fromisoformat(p["created_on"]) >= cutoff
counts[p["state"].lower()] += 1
authors.add(p["author"]["display_name"])
if authors:
rows.append(f"{repo['slug']} | {counts['opened']} | {counts['merged']} | {counts['declined']} | {', '.join(sorted(authors))}")
notify.email_me("Bitbucket pull requests last week", "\n".join(rows))
return {"repos": len(rows) - 1}FAQ
Common questions
Why is date filtering done after fetching rather than in the Bitbucket query?
Does a pull request merged this week but opened last month count as opened?
Can it report on only some repositories?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a morning list of pull requests waiting too long
Every weekday you see which pull requests have been open for more than three days, so reviews do not stall.
See how it worksGet an email when a Bitbucket build fails
As soon as a pipeline or build fails, you get the commit and the pull request it belongs to.
See how it worksPost new Bitbucket pull requests to Slack
Each newly opened pull request shows up in your team channel with its author and reviewers.
See how it worksKeep exploring
Set up “Get a weekly pull request report per repo” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.