# How to Add Estimated Review Time and Context Labels to Pull Requests | LinearB Blog

> The easiest way to cut down your code review time is as simple as letting developers know how long a review will take.

_This is a markdown rendering of a live HTML page on linearb.io, generated for AI/LLM consumption — it is not a markdown-only site. To get the full HTML page instead, request this URL with an explicit `Accept: text/html` header (no wildcard, no markdown preference)._

[Blog](https://linearb.io/blog)

/

How to Add Estimated Review Time and Context Labels to Pull Requests

# How to Add Estimated Review Time and Context Labels to Pull Requests

![Photo of gitStream Team](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/logo-mark-lg?_a=BAVMn6ID0)

By [gitStream Team](https://linearb.io/blog/how-to-add-estimated-review-time#git-stream-team)

|

December 21, 2022

![Text_Bee_7e34717b0a](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Text_Bee_7e34717b0a?_a=BAVMn6ID0)

The pull request (PR) review process, if not set up well in your team, can create a lot of bottlenecks in getting your code merged into the main branch and into production. By adding more context and information automatically to your PRs, you save yourself and your team work.

Take the scenario of fixing a typo in documentation. If there’s a backlog of PRs that need attention, such a PR may take two days — or longer — just to be approved. This is where [continuous merge](https://linearb.io/blog/what-is-continuous-merge) (CM) with gitStream comes in.

[gitStream](https://github.com/marketplace/gitstream-by-linearb) is a tool that allows you to add context and automation to your PRs, classifying PRs based on their complexity. 

This ensures that a review won’t stay in the queue for long as it can be quickly assigned to the right person, immediately approved or have the appropriate action identified easily. 

This hands-on article demonstrates how to add gitStream CM to your repository. 

In this article, you’ll learn:

1. How to Configure your Repository
2. How to Create Pull Requests (PRs)
3. How to Add the CM Feature to Your PRs

## Quick gitStream Setup Guide

If you’re keen to get all the benefits of gitStream and continuous merge right away, all you need to do is follow these simple steps. If you want to understand how gitStream works, how you can customize it and more options, it will follow right after.

1. Choose Install for free on ‘s GitHub marketplace page
2. Add 2 files to your repo:

```
a) .cm/gitstream.cm
b) .github/workflows/gitstream.yml
```

3\. Open a pull request  
4\. Set gitStream as a required check

[](https://github.com/apps/gitstream-cm/installations/new)

## A Comprehensive Guide to gitStream & Continuous Merge

[Filter functions](https://docs.gitstream.cm/filter-functions/) and [context variables](https://docs.gitstream.cm/context-variables/) are used to effect [automated actions](https://docs.gitstream.cm/automation-actions/), such as adding labels (add-label@v1), assigning reviewers (add-reviewers@v1), and approving requests (approve@v1), among others. 

Everything is included in a .cm configuration file named gitstream.cm. 

All instructions to gitStream CM are detailed in the docs found at [docs.gitstream.cm](https://docs.gitstream.cm/). gitStream also uses GitHub Actions to do its work, so you’ll need to add the gitstream.yml file to your GitHub Actions directory at .github/workflows/.

The main components to fulfill gitStream’s CM are:

* The configuration files: gitstream.cm and gitstream.yml.
* The filter functions: Code that tries to check and/or select certain data types from the input for checks during a PR creation.
* The context variables: The inputs fed to the filter functions.
* The automation actions.

**Note:** Some steps use Python only for demonstration purposes. It’s not required knowledge.

### Prerequisites

To follow this tutorial, ensure you have the following:

* Hands-on knowledge of Git and GitHub workings. You must know activities such as creating a repository, PRs, commits, and pushes.
* A GitHub account.
* Git installed in your working environment.

You can find and review the final project code [here](https://github.com/marketplace/gitstream-by-linearb).

### Step 1 – Set Up gitStream on Your Repo

Create an empty repo and give it a name, then install gitStream to it from the marketplace. 

After installation, you can either: 1) Clone the repository to your environment; or 2) Create a folder and point it to the repository. This tutorial uses the second option.

Create a folder called gitStreamDemo. In this folder, create two directories, .github/workflows and .cm, using the commands in a terminal window below:

```
mkdir -p .github/workflows

mkdir .cm
```

In the .github/workflows folder, create a file called gitstream.yml and add the following YAML script:

```
name: gitStream workflow automation

on:

workflow_dispatch:

  inputs:

    client_payload:

      description: The Client payload

      required: true

    full_repository:

      description: the repository name include the owner in `owner/repo_name` format

      required: true

    head_ref:

      description: the head sha

      required: true

    base_ref:

      description: the base ref 

      required: true

    installation_id:

      description: the installation id

      required: false

    resolver_url:

      description: the resolver url to pass results to

      required: true

    resolver_token:

      description: Optional resolver token for resolver service

      required: false

      default: ''

jobs:

  gitStream:

    timeout-minutes: 5

    # uncomment this condition, if you dont want any automation on dependabot PRs

    # if: github.actor != 'dependabot[bot]'

    runs-on: ubuntu-latest

    name: gitStream workflow automation

    steps:

      - name: Evaluate Rules

        uses: linear-b/gitstream-github-action@v1

        id: rules-engine

        with:

          full_repository: ${{ github.event.inputs.full_repository }}

          head_ref: ${{ github.event.inputs.head_ref }}

          base_ref: ${{ github.event.inputs.base_ref }}

          client_payload: ${{ github.event.inputs.client_payload }}

          installation_id: ${{ github.event.inputs.installation_id }}

          resolver_url: ${{ github.event.inputs.resolver_url }}

          resolver_token: ${{ github.event.inputs.resolver_token }}
```

Next, create a file called gitstream.cm in the .cm folder and add the following code:

```
manifest:

  version: 1.0

automations:

  show_estimated_time_to_review:

    if:

      - true

    run:

      - action : add-label@v1

      args:

       label: "{{ calc.etr }} min review"

       color: {{ '00ff00' if (calc.etr >= 20) else ('7B3F00' if (calc.etr >= 5) else '0044ff') }}

  safe_changes:

    if:

      - {{ is.doc_formatting or is.doc_update }}

    run:

      - action: add-label@v1

       args:

       label: 'documentation changes: PR approved'

       color: {{'71797e'}}

      - action: approve@v1

  domain_review:

    if:

      - {{ is.domain_change }}

    run:

      - action: add-reviewers@v1

      args:

       reviewers: [<listofreviewers>]

      - action: add-label@v1

      args:

       label: 'domain reviewer assigned'

       color: {{'71797e'}}

  set_default_comment:

    if:

      - true

    run:

      - action: add-comment@v1

      args:

       comment: "Hello there. Thank you for creating a pull request with us. A reviewer will soon get in touch."

calc:

  etr: {{ branch | estimatedReviewTime }}

is:

  domain_change: {{ files | match(regex=r/domain\//) | some }}

  doc_formatting: {{ source.diff.files | isFormattingChange }}

  doc_update: {{ files | allDocs }}
```

In the file, you’ll see the following four automation actions:

* show\_estimated\_time\_to\_review: This automation calculates the estimated time a review to a PR may take.
* safe\_changes: This shows if changes to non-critical components done in a PR are safe, such as document changes. The PR is automatically approved.
* domain\_review: This automation runs to show if a change was made to the domain layer.
* set\_default\_comment: This is fired every time a PR is opened and raises an acknowledgment comment to the user that a PR has been created.

At the end of the document, there’s a section containing filter functions for the automation actions. The actions are run after certain conditions specified in the filter functions or keys are met.

### Step 2 – Calculating the Time to Review

In the first automation, check the value of the etr variable and decide which label to assign to the PR. For more information on how [ETR is calculated, check out this blog.](https://linearb.io/blog/why-estimated-review-time-improves-pull-requests-and-reduces-cycle-time)

Create a file called main.py in the root of your folder. Then, create three folders using the command below:

```
mkdir views domain data
```

Add the following to the main.py file:

```
def show_message(name1, name2):

  print(f'Hello, {name}. Welcome to the gitStream world')

if __name__ == '__main__':

  print_hi('Mike')
```

Copy the main.py file as is and paste it to the other three folders. Rename them to match the folders’ names (domain.py) for the domain folder.

For the dummy documentation file, create a README.md file in the root of your folder and add the following markdown script.

```
# gitStreamDemo
```

A demo showing how to set up gitStream on your first repo

Now, run these commands to initialize the repository, stage the files for committing, and make a commit, in that order:

```
git init

git add .

git commit -am “initialization”
```

Next, point the folder to your repository using the command below:

```
git remote add origin https://github.com/<your-username>/<your-repo-name>
```

Finally, push it:

```
git push -u origin main
```

### Step 3 – Creating the Repository

As you may have noticed, there’s a sample bug in the code. In any programming language, you must call the function using its exact name. But in this case, print\_hi was called instead of show\_message. As a team member or an open-source contributor, you can fix this by opening a PR.

First, create a branch called fix-function-call and checkout into the branch using the commands below:

```
git branch fix-function-call

git checkout fix-function-call
```

Next, replace the name print\_hi with show\_message in all the .py files, then commit and push the changes.

```
git commit -am “changed function name”

git push --set-upstream origin fix-function-call
```

Now, open your repository in GitHub. You’ll see the following card:

![gitStream status](https://assets.linearb.io/uploads/2022/12/Screen-Shot-2022-12-13-at-11.06.15-AM-1024x128.png)

Click on **Compare & pull request**. On the next page, click the **Create pull request** button.

Once the gitStream automation has finished running, you’ll see the **domain reviewer assigned** tag. Additionally, a comment has been created.

![gitStream status update No. 2](https://assets.linearb.io/uploads/2022/12/Screen-Shot-2022-12-13-at-11.08.26-AM-1024x123.png)

Add this Dijkstra’s Shortest Path Algorithm [script](https://github.com/Agusioma/dijkstra-in-python/blob/main/dijkstra.py) just below the show\_message function in each of the .py files again. These scripts calculate the shortest path for a node in a graph.

Commit the changes and then push the code.

```
git commit -am “updates”

git push
```

![gitStream status update No. 3](https://assets.linearb.io/uploads/2022/12/Screen-Shot-2022-12-13-at-11.11.10-AM-1024x195.png)

## Creating a Safe Change

For the final automation, you’ll add text to the README.md file created earlier. Create a new branch and checkout to it. You do so because you’ll need a new PR to demonstrate this automation.

```
git checkout main

git branch update_docs

git checkout update_docs
```

Then, add this sentence to the README.md file:

```
Continuous Merging is very beneficial to the Open-Source Community.
```

Commit and push.

```
git commit -am “updated the docs”

git push --set-upstream origin update_docs
```

When the checks are done, you’ll see a different label with the PR already approved.

![gitStream status update No. 4](https://assets.linearb.io/uploads/2022/12/Screen-Shot-2022-12-13-at-11.13.19-AM-1024x198.png)

## Help Developers Make the Most of Their Time…

Reviewing and merging PRs are crucial in contributing to software development and enhancing team productivity. However, being unable to classify PRs by complexity can lead to long wait times or much back-and-forth in the review process.

CM remedies this issue by classifying PRs based on the complexity, automating some actions including tagging the appropriate reviewers, assigning them PRs, and approving PRs among others to reduce the backlog.

Check out [gitStream](https://linearb.io/dev/gitstream) to add CM to your existing repos.

## Improve developer productivity with LinearB

Find us on

[](https://www.linkedin.com/company/linearb)
[](https://devinterrupted.substack.com/)

## Your next read

[![Cover image for AI ROI comes from measuring engineering outcomes on day one](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_AI_ROI_comes_from_measuring_engineering_software_security_2400x1256_2c5eae0862?_a=BAVMn6ID0)](https://linearb.io/blog/kraken-nik-sudan-measure-ai-roi-engineering-outcomes)

Product

[AI ROI comes from measuring engineering outcomes on day one](https://linearb.io/blog/kraken-nik-sudan-measure-ai-roi-engineering-outcomes)

Kraken Engineering Operations Lead Nik Sudan details how to establish day-one data infrastructure to accurately measure AI ROI. Discover why raw token adoption...

[![Cover image for Best Appfire Flow alternatives in 2026](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_Moving_beyond_flow_88c071e703?_a=BAVMn6ID0)](https://linearb.io/blog/flow-alternatives-2026)

Product

[Best Appfire Flow alternatives in 2026](https://linearb.io/blog/flow-alternatives-2026)

Flow provides DORA metrics, workflow diagnostics, and useful dashboards for engineering leadership. But it has real limitations, and the market has moved...

[![Cover image for 8 million pull requests reveal where engineering productivity breaks down](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_8_million_pull_requests_2400x1256_03724bfbb2?_a=BAVMn6ID0)](https://linearb.io/blog/8-million-prs-engineering-productivity)

Product

[8 million pull requests reveal where engineering productivity breaks down](https://linearb.io/blog/8-million-prs-engineering-productivity)

8.1M pull requests reveal the gap between AI adoption and engineering impact, and why code review is the bottleneck blocking real productivity gains.

## Structured data

_Machine-readable metadata (JSON-LD) embedded in the page for search/AI context — not content rendered on the page itself._

```json
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "LinearB",
  "url": "https://linearb.io/",
  "logo": "https://assets.linearb.io/image/upload/v1715628027/logo-mark-lg.svg",
  "description": "LinearB is the engineering productivity platform that helps engineering leaders prove AI is improving throughput without sacrificing delivery confidence, flow efficiency, or developer experience.",
  "sameAs": [
    "https://www.linkedin.com/company/linearb"
  ],
  "award": [
    {
      "@type": "Award",
      "name": "LinearB is a Leader in the 2026 Gartner® Magic Quadrant™ for Developer Productivity Insight Platforms",
      "dateAwarded": "2026",
      "awardedBy": {
        "@type": "Organization",
        "name": "Gartner®"
      }
    },
    {
      "@type": "Award",
      "name": "Great Place to Work Certification",
      "dateAwarded": "2025-2027",
      "awardedBy": {
        "@type": "Organization",
        "name": "Great Place to Work"
      }
    },
    {
      "@type": "Award",
      "name": "America's Best Startup Employers 2025",
      "dateAwarded": "2025",
      "awardedBy": {
        "@type": "Organization",
        "name": "Forbes Magazine"
      }
    }
  ],
  "hasCertification": [
    {
      "@type": "Certification",
      "name": "SOC 1 Type 2"
    },
    {
      "@type": "Certification",
      "name": "SOC 2 Type 2"
    },
    {
      "@type": "Certification",
      "name": "GDPR Compliance certification"
    },
    {
      "@type": "Certification",
      "name": "ISO 27001"
    }
  ]
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "How to Add Estimated Review Time and Context Labels to Pull Requests",
  "url": "https://linearb.io/blog/how-to-add-estimated-review-time",
  "author": {
    "@type": "Person",
    "name": "gitStream Team"
  },
  "datePublished": "2022-12-21T16:56:12.000Z",
  "dateModified": "2022-12-21T16:56:12.000Z",
  "image": "https://assets.linearb.io/image/upload/v1720000000/Text_Bee_7e34717b0a.png",
  "publisher": {
    "@type": "Organization",
    "name": "LinearB",
    "logo": "https://assets.linearb.io/image/upload/v1777485755/linearb-logo-2026.png"
  },
  "description": "The easiest way to cut down your code review time is as simple as letting developers know how long a review will take.\n"
}
```

## More on linearb.io

### Top navigation

- [Book a Demo](https://linearb.io/book-a-demo)
- [AI Code Reviews — Catch security risks, bugs, and spec mismatches](https://linearb.io/platform/ai-code-reviews)
- [AI & Productivity Insights — See how AI tools affect cycle time and delivery speed](https://linearb.io/platform/ai-developer-productivity-insights)
- [Measure AI Impact — Track AI adoption and tie it to delivery outcomes](https://linearb.io/use-case/measure-ai-impact)
- [MCP Server — Chat with your data to spot patterns and boost output](https://linearb.io/platform/mcp-server)
- [Resource Allocation — Cost initiatives and shape your investment strategy](https://linearb.io/platform/resource-allocation)
- [Cost Capitalization — Capitalize engineering costs with audit-ready reports](https://linearb.io/platform/cost-capitalization)
- [Dev Team Management — Set targets and tie throughput to business outcomes](https://linearb.io/platform/goals-and-reporting)
- [DevOps Workflow Automation — Policy-based PR routing, approvals, and tests](https://linearb.io/platform/ai-workflow-governance)
- [AI Powered Support — Unify AI and human code delivery in one clear view](https://linearb.io/use-case/ai-powered-support)
- [Optimization — Surface friction with feedback and MCP insights](https://linearb.io/platform/developer-experience)
- [Reporting — Spot what's working and what needs attention](https://linearb.io/use-case/measuring-developer-experience)
- [Surveys — Turn developer feedback into actionable signals](https://linearb.io/platform/developer-surveys)
- [Platform overview](https://linearb.io/platform/overview)
- [Register now](https://linearb.io/event/engineering-productivity-gap)
- [Customers](https://linearb.io/customers)
- [Pricing](https://linearb.io/pricing)
- [Why choose LinearB — Explore your data. Measure performance. Act to improve it.](https://linearb.io/why-linearb)
- [APEX framework — The operating model for AI-era engineering teams](https://linearb.io/resources/apex-framework)
- [Anti-FAQ — The questions other vendors won't answer](https://linearb.io/why-linearb/anti-faq)
- [Security — Enterprise-grade compliance and zero code access](https://linearb.io/security)
- [Build vs. buy — The hidden cost of building it yourself](https://linearb.io/resources/build-vs-buy)
- [Dev Interrupted Podcast — Conversations with engineering leaders](https://linearb.io/dev-interrupted/podcasts)
- [Reports & Guides — Deep dives on productivity and delivery](https://linearb.io/resources)
- [Webinars — Expert sessions on productivity and AI](https://linearb.io/resources?category=workshops)
- [Metrics Benchmarks — See how your engineering org stacks up](https://linearb.io/resources/software-engineering-benchmarks-report)
- [Blog — Product updates and practical insights](https://linearb.io/blog)
- [Help Center — Documentation, setup, and support](https://linearb.helpdocs.io)
- [API Docs](https://docs.linearb.io/api-overview)
- [Status](https://www.linearbstatus.com/)
- [Integrations](https://linearb.io/integrations)
- [LinearB is a Leader in the 2026 Gartner® Magic Quadrant™ for Developer Productivity Insight Platforms](https://linearb.io/resources/gartner-magic-quadrant-dpi-platforms-2026)
- [Sign in](https://app.linearb.io/login)
- [Enterprise](https://linearb.io/solutions/enterprise)
- [Contact](https://linearb.io/contact-us)
- [About us](https://linearb.io/about-us)
- [Careers](https://linearb.io/careers)
- [Service agreement](https://linearb.io/services-agreement)
- [Privacy policy](https://linearb.io/privacy-policy)
- [DPA](https://linearb.io/data-processing-agreement)
- [Security FAQ](https://linearb.io/security-faq)
- [Substack](https://devinterrupted.substack.com/)

### Footer

_Additional links from the site footer, not repeated from the top navigation above._

- [GitHub](https://github.com/linear-b)
- [LinkedIn](https://www.linkedin.com/company/linearb)
- [Twitter](https://twitter.com/LinearB_Inc)