Skip to content

Integrate gitStream with LinearB

LinearB is a software delivery management platform that makes it easy to benchmark your engineering organization, track engineering metrics and identify opportunities for improvement.

Track the Impact of Generative AI Initiatives

These examples show how to label PRs that are assisted by GitHub Copilot so you can easily track productivity within LinearB. These examples can be adapted for any other generative AI solutions you might use.

Track Copilot Initiatives in LinearB

Automatically apply labels to PRs that are assisted by GitHub Copilot. You can apply labels based on a known list of Copilot users, PR tags, or by prompting the PR author to indicate if they used Copilot.

Prompt PR authors to indicate if they used Copilot for the PR and automatically label the PR if they did. This requires two separate automation files to handle posting the prompt and labeling accordingly.

Label Copilot by Prompt

Configuration Description

Conditions:

  • A PR is created

Automation Actions:

  • Post a comment prompting the author to indicate if Copilot assisted the author with writing the code in the PR.

Ask the PR author about Copilot usage.

-*- mode: yaml -*-

manifest:
  version: 1.0

on:
  - pr_created

automations:
  comment_copilot_prompt:
    # Post a comment for all PRs to prompt the PR author to indicate whether they used Copilot to assist coding in this PR
    if:
      - true
    run:
      - action: add-comment@v1
        args:
          comment: |
            Please mark whether you used Copilot to assist coding in this PR

            - [ ] Copilot Assisted
            - [ ] Not Copilot Assisted

Configuration Description

Conditions:

  • A PR is updated or merged where the author indicates they used Copilot via a prompt.

Automation Actions:

  • Apply a 🤖 Copilot label to the PR

Label PRs where the user indicated Copilot usage

-*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  # You should use this automation in conjunction with comment_copilot_prompt.cm
  label_copilot_pr:
    # If the PR author has indicated that they used Copilot to assist coding in this PR, 
    # apply a label indicating the PR was supported by Copilot
    if:
      - {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter (attr='content', regex=r/\- \[x\] Copilot Assisted/) | some}}
    run:
      - action: add-label@v1
        args:
          label: '🤖 Copilot'

Automatically apply labels to PRs that are created by known users of generative AI coding tools.

Label by Contributors

Configuration Description

Conditions:

  • The PR author is one of a specified list of contributors

Automation Actions:

  • Apply a 🤖 Copilot label to the PR

Label by Contributors

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  label_genai:
    # For all PRs authored by someone who is specified in the genai_contributors list
    if:
      - {{ pr.author | match(list=genai_contributors) | some  }}
    # Apply a label indicating the user has adopted Copilot
    run:
      - action: add-label@v1
        args:
          label: '🤖 Copilot'

genai_contributors:
  - username1
  - username2
  - etc

Look for a specific tag in the PR title, description, comments or commit messages and if found add a label to the PR

Label Copilot by Tag

Configuration Description

Conditions:

  • The #copilot# tag is found in any of the PR title, description, comments or commit messages for commits in the PR

Automation Actions:

  • Apply a 🤖 Copilot label to the PR

Label Copilot by Tag

# -*- mode: yaml -*-

manifest:
  version: 1.0

on:
  - comment_added
  - commit
  - pr_created

automations:
  label_copilot:
    # Detect PRs that contain the text '#copilot#' in the title, description, comments, or commit messages
    if:
      - {{ copilot_tag.pr_title or copilot_tag.pr_desc or copilot_tag.pr_comments or copilot_tag.commit_messages  }}
    # Apply a label indicating the user has adopted Copilot
    run:
      - action: add-label@v1
        args:
          label: '🤖 Copilot'

copilot_tag:
  pr_title: {{ pr.title | includes(regex=r/#copilot#/) }}
  pr_desc: {{pr.description | includes(regex=r/#copilot#/) }}
  pr_comments: {{ pr.comments | map(attr='content') | match(regex=r/#copilot#/) | some }}
  commit_messages: {{ branch.commits.messages | match(regex=r/#copilot#/) | some }}

Label Changes to Track in LinearB

These examples show how to label PRs based on the changed code so you can more easily compare metrics across languages, frameworks, changed directories, and more.

Track Copilot Initiatives in LinearB

Automatically label PRs to indicate what resources are being changed.

Label Modified Resources

Configuration Description

Conditions (all must be true):

  • A PR is created or updated.

Automation Actions:

  • Apply labels based on the branch name or modified resources.

Label Modified Resources

# -*- mode: yaml -*-
manifest:
  version: 1.0

automations:
  {% for item in labels %}
  label_resource_{{ item.name }}:
      if:
        -{{ branch.name | includes(regex=item.branch) or files | match(list=item.resources) }}
      run:
        - action: add-label@v1
          args:
            label: {{ item.name }}
  {% endfor %}

labels:
  - name: Core
    resources:
    - src/app
    branch: r/^core-/
  - name: mobile
    resources:
    - src/android
    - src/ios
    branch: r/^mobile-/

Automatically detect which programming languages are contained in PRs and automatically label the PRs appropriately.

Label PRs by Language

Configuration Description

Conditions (all must be true):

  • A PR is created or updated.

Automation Actions:

  • Label the PR for each programming language that is included.

Label PRs by Language

# -*- mode: yaml -*-
manifest:
  version: 1.0

automations:
  {% for item in labels %}
  label_{{ item.name }}_pr:
      if:
        - {{ files | match(regex=item.resources) | some }}
      run:
        - action: add-label@v1
          args:
            label: '{{ item.name }}'
  {% endfor %}

labels:
  - name: Java
    resources: r/.java$/
  - name: Rust
    resources: r/.rs$/
  - name: HTML
    resources: r/.html$/
  - name: JavaScript
    resources: r/.js$/
  - name: Python
    resources: r/.py$/
  - name: Golang
    resources: r/.go$/
  - name: Ruby
    resources: r/.rb$/
  - name: CSS
    resources: r/.css/

Additional Resources

gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.

Learn More about how gitStream Works.

More Automations can be found on the Automation Library and Integrations pages.