Skip to content

docs: add pr.author_type context variable [LINBEE-12321] - #859

Merged
MishaKav merged 1 commit into
mainfrom
LINBEE-12321-document-pr-author-type
Jul 28, 2026
Merged

docs: add pr.author_type context variable [LINBEE-12321]#859
MishaKav merged 1 commit into
mainfrom
LINBEE-12321-document-pr-author-type

Conversation

@MishaKav

@MishaKav MishaKav commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Documents pr.author_type (user / bot / organization).

Values are lowercase, matching pr.status and repo.visibility. Notes the two coverage limits: GitHub PAT-based automation and Bitbucket access-token bot users both report user.

✨ PR Description

Purpose: Document the new pr.author_type context variable that identifies PR author account type (user, bot, or organization).

Main changes:

  • Added pr.author_type field to PR context variables table with string type and account kind values
  • Included comprehensive documentation section explaining limitations on GitHub (GitHub Apps only) and Bitbucket platform differences
  • Provided automation examples showing bot detection without maintaining bot name lists

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

Documents the new variable, the lowercase values, and the two coverage
limits (GitHub PAT-based automation and Bitbucket access-token bot users
both report `user`).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@orca-security-us orca-security-us Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed OSS Licenses high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@MishaKav
MishaKav requested a review from Copilot July 27, 2026 14:49

@linearb linearb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ PR Review

The PR is a clear and useful documentation addition for pr.author_type. The explanation of limitations and the fallback example pattern are valuable. One subtle but important issue exists in the example code snippet that could mislead users.

1 issues detected:

🐞 Bug - `"[bot]"` is a regex character class matching one of 'b', 'o', or 't', not the literal `[bot]` suffix used in GitHub bot usernames. 🛠️

Details: In the fallback example, "[bot]" is used as a match-list entry. In regex, [bot] is a character class that matches any single character that is 'b', 'o', or 't' — not the literal string [bot]. GitHub appends the literal suffix [bot] to automated account usernames (e.g., github-actions[bot], dependabot[bot]), so the documented pattern will silently produce incorrect results: it will match far too broadly (any name containing 'b', 'o', or 't') while missing the exact intended pattern.

File: docs/context-variables.md (335-335)

🛠️ A suggested code correction is included in the review comments.

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how

Comment thread docs/context-variables.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation for the new pr.author_type context variable so automations can distinguish PRs opened by user, bot, or organization, and includes platform-specific caveats to set expectations.

Changes:

  • Added pr.author_type to the pr context variable table.
  • Added a dedicated “PR author type” note section with usage examples and GitHub/Bitbucket limitations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/context-variables.md
Comment thread docs/context-variables.md
@MishaKav

Copy link
Copy Markdown
Collaborator Author

/gs feedback False positive. match(list=[...]) does substring matching, not regex — the two are mutually exclusive parameters. In gitstream-core src/rules-parser/filters/general-filters.ts:26-39, termRegexOrList routes term and list entries through internalIncludes and only regex= through internalRegex; internalIncludes is file?.includes(searchTerm) (src/rules-parser/filters/common.ts:3), and parseTermToValidString only treats a value as a pattern when it starts with r/. So "[bot]" is matched as the literal 4-character string, never as a character class. Corroborating evidence: gitStream ships this exact list in its own default automations — bot_author: {{ pr.author | match(list=["github-actions", "_bot_", "[bot]", "dependabot"]) | some }} (gitstream-sls-pipeline src/common/cmFile/defaultAutomations.consts.ts:217). If the finding were correct, default bot detection would be broken for every customer. No docs change needed.

@MishaKav
MishaKav enabled auto-merge (squash) July 28, 2026 08:25
@MishaKav
MishaKav requested a review from a team July 28, 2026 08:26
@MishaKav
MishaKav merged commit 3803847 into main Jul 28, 2026
11 checks passed
@MishaKav
MishaKav deleted the LINBEE-12321-document-pr-author-type branch July 28, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add author type to all author context instances

3 participants