Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/context-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ The `pr` context includes metadata related to the pull request.
| `pr.author` | String | The PR author name |
| `pr.author_is_org_member` | Bool | `true` if the PR author is a member of the organization where gitStream is installed |
| `pr.author_teams` | String | The teams which the PR author is member of |
| `pr.author_type` | String | The kind of account that opened the PR: `user`, `bot` or `organization`. See [note](#pr-author-type) |
| `pr.checks` | [[`Check`]](#check-structure) | List of checks, names and status |
| `pr.comments` | [[`Comment`]](#comment-structure) | List of PR comments objects |
| `pr.commit_statuses` :fontawesome-brands-github: | [[`CommitStatus`]](#commitstatus-structure) | List of commit status check objects from external CI systems. |
Expand All @@ -301,6 +302,39 @@ The `pr` context includes metadata related to the pull request.
| `pr.updated_at` | String | The date and time the PR was last updated |
| `pr.url` | String | A link to the PR on |

##### PR author type

`pr.author_type` reports the kind of account that opened the PR, so automations can skip
machine-authored changes without maintaining a list of bot names:

```yaml+jinja
automations:
senior_review:
if:
- {{ pr.author_type != 'bot' }}
run:
- action: add-reviewers@v1
args:
reviewers: [senior-devs]
```

The value is lowercase, like `pr.status` and `repo.visibility`.

Two limitations are worth knowing:

- On GitHub, only GitHub Apps report `bot`. Automation that authenticates with a personal access
token - self-hosted Renovate, in-house CI bots - reports `user`.
Comment thread
MishaKav marked this conversation as resolved.
- On Bitbucket, apps report `bot` and workspaces report `organization`, but the bot user that
Bitbucket creates for each access token still reports `user`.

The value is empty when gitStream could not determine the account kind. For full coverage, keep
matching on the author name as well:

```yaml+jinja
is:
bot_author: {{ pr.author_type == 'bot' or (pr.author | match(list=["[bot]", "dependabot"]) | some) }}
Comment thread
MishaKav marked this conversation as resolved.
Comment thread
MishaKav marked this conversation as resolved.
```

Example for checking the PR title includes a Jira ticket:

```yaml+jinja
Expand Down