Log in to v3

GitHub context reference

The following variables are available at the root level when writing conditions and templates. For variables that are custom objects, see their properties further down the page.

active_lock_reason str

Example: too heated

additions int

Example: 100

all function

Return True if bool(x) is True for all values x in the iterable.

If the iterable is empty, return True.

any function

Return True if bool(x) is True for any x in the iterable.

If the iterable is empty, return False.

assignee User

assignees Users

author User

author_association str

auto_merge str

base Branch

body str

Example: Please pull these awesome changes

changed_files int

Example: 5

check_runs CheckRuns

closed_at datetime

Example: 2011-01-26T19:01:12Z

comments int

Example: 10

commits Commits

Example: 3

contains_any_fnmatches function

contains_any_fnmatches(files, ['api/*', 'tests/*'])

contains_any_globs function

contains_any_globs(files, ['api/**', 'tests/*.py'])

contains_fnmatch function

contains_fnmatch(title, 'WIP*')

contains_glob function

contains_glob(file.filename, 'app/**/*.py')

contains_regex function

contains_regex(title, 'WIP.*')

count function

Return the number of items in a container.

created_at datetime

Example: 2011-01-26T19:01:12Z

date function

Parses a date from a string using dateparser.

date('3 days ago')

date('8/10/1995')

deletions int

Example: 3

draft bool

Indicates whether or not the pull request is a draft.

files Files

glob function

glob('*.py')

groups Groups

head Branch

html_url str

Example: https://github.com/octocat/Hello-World/pull/1347

id int

Example: 1

labels Labels

len function

Return the number of items in a container.

length function

Return the number of items in a container.

locked bool

Example: True

maintainer_can_modify bool

Indicates whether maintainers can modify the pull request.

Example: True

merge_commit_sha str

Example: e5bd3914e2e596debea16f433f57875b5b90bcd6

mergeable bool

Example: True

mergeable_state str

Example: clean

merged bool

merged_at datetime

Example: 2011-01-26T19:01:12Z

merged_by User

milestone Milestone

number int

Number uniquely identifying the pull request within its repository.

Example: 42

percent_chance method

Returns True if this PR is within the percent_chance

percent_chance(33) will be True on roughly 1/3 of PRs

rebaseable bool

Example: True

regex function

regex('WIP: .*')

requested_reviewers Users

requested_teams Teams

review_comments int

state str

State of this Pull Request. Either open or closed.

Example: open

statuses Statuses

text_list function

Returns a readable, comma-separated list of items for printing in templates.

text_list(['a', 'b', 'c', 'd']) == 'a, b, c or d'

text_list(['a', 'b', 'c'], 'and') == 'a, b and c'

text_list(['a', 'b'], 'and') == 'a and b'

text_list(['a']) == 'a'

text_list([]) == ''

title str

The title of the pull request.

Example: Amazing new feature

updated_at datetime

Example: 2011-01-26T19:01:12Z

user User

Branch

label str

ref str

repo Repo

sha str

user User

CheckRuns

Checks runs are pulled from the most recent commit on the pull request. Results of GitHub Actions are found here. See the GitHub documentation for more information.

action_required CheckRuns

cancelled CheckRuns

completed CheckRuns

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

failed CheckRuns

failure CheckRuns

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

in_progress CheckRuns

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

names list

neutral CheckRuns

queued CheckRuns

skipped CheckRuns

stale CheckRuns

success CheckRuns

successful CheckRuns

timed_out CheckRuns

Commit

author dict

commit dict

committer dict

html_url str

Example: https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e

is_signed_off bool

message str

parents list of dict

sha str

Example: 6dcb09b5b57875f334f61aebed695e2e4193db5e

Commits

are_signed_off bool

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

shas list of str

File

additions int

changes int

deletions int

filename str

patch str

sha str

status str

Files

See the GitHub documentation for more information.

added Files

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

filenames list of str

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

lines_added list of str

lines_modified list of str

lines_removed list of str

modified Files

patches list of str

removed Files

Group

A PullApprove review group

author_value int

conditions list

description str

is_active bool

is_passing bool

labels dict

name str

request int

request_order str

required int

requirements list

reviewed_for str

score int

state str

teams list

type str

users list of str

users_approved list

users_available list

users_pending list

users_rejected list

users_requested list

users_unavailable list

users_unrequested list

Groups

Groups is a list of Group objects with a few handy shortcuts.

active Groups

approved Groups

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

inactive Groups

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

names list of str

optional Groups

passing Groups

pending Groups

rejected Groups

required Groups

users_approved list

users_available list

users_pending list

users_rejected list

users_unavailable list

Label

color str

6-character hex code, without the leading #, identifying the color

Example: FFFFFF

default bool

Example: True

description str

Example: Something isn't working

id int

Example: 208045946

name str

The name of the label.

Example: bug

Labels

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

names list of str

Milestone

closed_at datetime

Example: 2013-02-12T13:22:01Z

closed_issues int

Example: 8

created_at datetime

Example: 2011-04-10T20:09:31Z

creator User

description str

Example: Tracking milestone for version 1.0

due_on datetime

Example: 2012-10-09T23:39:01Z

html_url str

Example: https://github.com/octocat/Hello-World/milestones/v1.0

id int

Example: 1002604

number int

The number of the milestone.

Example: 42

open_issues int

Example: 4

state str

The state of the milestone.

Example: open

title str

The title of the milestone.

Example: v1.0

updated_at datetime

Example: 2014-03-03T18:58:10Z

Repo

allow_forking bool

archived bool

created_at datetime

default_branch str

description str

disabled bool

fork bool

forks int

forks_count int

full_name str

has_downloads bool

has_issues bool

has_pages bool

has_projects bool

has_wiki bool

homepage str

html_url str

id int

language str

license str

name str

open_issues int

open_issues_count int

owner User

private bool

pushed_at datetime

size int

stargazers_count int

updated_at datetime

watchers int

watchers_count int

Status

context str

created_at datetime

description str

id int

state str

updated_at datetime

Statuses

Statuses are pulled from the most recent commit on the pull request. See the GitHub documentation for more information.

contexts list of str

errored Statuses

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

failed Statuses

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

pending Statuses

succeeded Statuses

successful Statuses

Team

description str

Description of the team

Example: A great team.

html_url str

Example: https://github.com/orgs/rails/teams/core

id int

Unique identifier of the team

Example: 1

name str

Name of the team

Example: Justice League

parent str

permission str

Permission that the team will have for its repositories

Example: admin

privacy str

The level of privacy this team should have

Example: closed

slug str

Example: justice-league

Teams

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

ids list of int

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

names list of str

User

gravatar_id str

Example: 41d064eb2195891e12d0413f63227ea7

html_url str

Example: https://github.com/octocat

id int

Example: 1

login str

Example: octocat

mention str

site_admin bool

type str

Example: User

username str

Users

exclude method

Filter down the list of objects using not contains behavior. Chainable with include.

files.exclude("*.md")

files.include("src/*").exclude("*.md")

get method

Gets a specific item in the list using the primary attribute (i.e. name, number, username).

include method

Filter down the list of objects using contains behavior. Chainable with exclude.

files.include("src/*")

files.include("src/*").exclude("*.md")

mentions list of str

usernames list of str