Skip to content

Automatically Label AI-Assisted PRs

Automatically apply labels to PRs based on whether they were assisted by AI tools. Developers can indicate the specific AI tools or models used, or pre-add an AI-related label to skip the prompt.

Ask Developers About AI Assistance

Prompt PR authors with a convenient checkbox survey to indicate which AI tools they used for the PR. Developers can pre-add any 🤖 ai-* label to skip the question. The automation checks for existing labels before posting the prompt.

Ask About AI Assistance

Configuration Description

Conditions:

  • A PR is created, and no 🤖 ai-* label is pre-applied.
  • The question hasn't been asked before.

Automation Actions:

  • Post a comment with a checkbox survey about AI tools used.
  • Apply labels based on the checkboxes selected.

Ask the PR author about AI assistance.

# -*- mode: yaml -*-

manifest:
  version: 1.0

triggers:
  on:
    - pr_created

automations:
  comment_ai_assistance_prompt:
    # Post a comment for all PRs to prompt the PR author to indicate whether they used AI to assist coding in this PR
    # Only do this if there's no existing AI-related label and we haven't asked before
    if:
      - {{ pr.labels | match(regex=r/🤖 ai-*/) | nope }}
      - {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter(attr='content', regex=r/Please mark which AI tools you used/) | nope }}
    run:
      - action: add-comment@v1
        args:
          comment: |
            Please mark which AI tools you used for this PR by checking the appropriate boxes:

            - [ ] GitHub Copilot
            - [ ] Cursor
            - [ ] Tabnine
            - [ ] JetBrains AI Assistant
            - [ ] VSCode IntelliCode
            - [ ] ChatGPT
            - [ ] Claude
            - [ ] Gemini
            - [ ] Other AI tool
            - [ ] No AI tools were used

            Tip: If you want to avoid this comment in the future, you can add a label of the format `🤖 ai-*` when creating your PR.

Track AI Tools

Add labels to the PR according to the tools that the developer checked in the micro-survey above Label AI Assistance

Configuration Description

Conditions:

  • A PR with selected checkboxes for AI tools used.
  • Optional: Details about AI Service and Model specified.

Automation Actions:

  • Apply labels for specific AI tools (e.g., 🤖 ai-copilot, 🤖 ai-cursor).
  • Apply labels for AI services and models if provided.

Track AI tools, models and services.

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  label_ai_tools_by_checkbox:
    # Apply labels based on the checkboxes selected in the PR comment
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] GitHub Copilot/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-copilot"

  label_ai_cursor:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Cursor/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-cursor"

  label_ai_tabnine:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Tabnine/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-tabnine"

  label_ai_jetbrains:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] JetBrains AI Assistant/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-jetbrains"

  label_ai_intellicode:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] VSCode IntelliCode/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-intellicode"

  label_ai_chatgpt:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] ChatGPT/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-chatgpt"

  label_ai_other:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Other AI tool/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-other"

  label_ai_none:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] No AI tools were used/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-none"

Ask Developers About AI Assistance

The automation will not prompt known users for AI assistance. This allows a smoother experience for users who were predefined as AI users, to avoid answering the same questions again.

Skip the survey for known users.

# -*- mode: yaml -*-

manifest:
  version: 1.0
triggers:
  on:
    - pr_created

automations:
  comment_ai_assistance_prompt:
    # Post a comment for all PRs to prompt the PR author to indicate whether they used AI to assist coding in this PR
    # Only do this if there's no existing AI-related label and we haven't asked before
    if:
      - {{ pr.labels | match(regex=r/🤖 ai-*/) | nope }}
      - {{ pr.author | match(list=copilot_contributors) | nope }}
      - {{ pr.author | match(list=cursor_contributors) | nope }}
    run:
      - action: add-comment@v1
        args:
          comment: |
            Please mark which AI tools you used for this PR by checking the appropriate boxes:

            - [ ] GitHub Copilot
            - [ ] Cursor
            - [ ] Tabnine
            - [ ] JetBrains AI Assistant
            - [ ] VSCode IntelliCode
            - [ ] ChatGPT
            - [ ] Claude
            - [ ] Gemini
            - [ ] Other AI tool
            - [ ] No AI tools were used

            **Tip**: If you want to avoid this comment in the future, add a label of the format `🤖 ai-*` when creating your PR, or ask your admin to add you to the pre-defined lists of known users

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

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

copilot_contributors:
  - username1
  - username2
  - usernameN

cursor_contributors:
  - username1
  - username2
  - usernameN

Track AI Tools

Add labels to the PR according to the tools that the developer checked in the micro-survey above Label AI Assistance

Track AI tools, models and services.

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  label_ai_tools_by_checkbox:
    # Apply labels based on the checkboxes selected in the PR comment
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] GitHub Copilot/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-copilot"

  label_ai_cursor:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Cursor/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-cursor"

  label_ai_tabnine:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Tabnine/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-tabnine"

  label_ai_jetbrains:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] JetBrains AI Assistant/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-jetbrains"

  label_ai_intellicode:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] VSCode IntelliCode/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-intellicode"

  label_ai_chatgpt:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] ChatGPT/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-chatgpt"

  label_ai_other:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] Other AI tool/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-other"

  label_ai_none:
    if:
      - {{ pr.comments | filter(attr='content', regex=r/\- \[x\] No AI tools were used/) | some }}
    run:
      - action: add-label@v1
        args:
          label: "🤖 ai-none"