Skip to main content

activities

Creates, updates, deletes, gets or lists an activities resource.

Overview

Nameactivities
TypeResource
Idgithub.repos.activities

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
node_idstring (example: MDEwOlJlcG9zaXRvcnkxMjk2MjY5)
activity_typestringThe type of the activity that was performed. (push, force_push, branch_deletion, branch_creation, pr_merge, merge_queue_merge) (example: force_push)
actorobjectA GitHub user. (title: Simple User)
afterstringThe SHA of the commit after the activity. (example: 827efc6d56897b048c772eb4087f854f46256132)
beforestringThe SHA of the commit before the activity. (example: 6dcb09b5b57875f334f61aebed695e2e4193db5e)
refstringThe full Git reference, formatted as refs/heads/<branch name>. (example: refs/heads/main)
timestampstring (date-time)The time when the activity occurred. (example: 2011-01-26T19:06:43Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_activitiesselectowner, repodirection, per_page, before, after, ref, actor, time_period, activity_typeLists a detailed history of changes to a repository, such as pushes, merges, force pushes, and branch changes, and associates these changes with commits and users.

For more information about viewing repository activity,
see "Viewing activity and data for your repository."

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
activity_typestringThe activity type to filter by. For example, you can choose to filter by "force_push", to see all force pushes to the repository.
actorstringThe GitHub username to use to filter by the actor who performed the activity.
afterstringA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
beforestringA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
directionstringThe direction to sort the results by.
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
refstringThe Git reference for the activities you want to list. The ref for a branch can be formatted either as refs/heads/BRANCH_NAME or BRANCH_NAME, where BRANCH_NAME is the name of your branch.
time_periodstringThe time period to filter by. For example, day will filter for activity that occurred in the past 24 hours, and week will filter for activity that occurred in the past 7 days (168 hours).

SELECT examples

Lists a detailed history of changes to a repository, such as pushes, merges, force pushes, and branch changes, and associates these changes with commits and users.

For more information about viewing repository activity,
see "Viewing activity and data for your repository."

SELECT
id,
node_id,
activity_type,
actor,
after,
before,
ref,
timestamp
FROM github.repos.activities
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND direction = '{{ direction }}'
AND per_page = '{{ per_page }}'
AND before = '{{ before }}'
AND after = '{{ after }}'
AND ref = '{{ ref }}'
AND actor = '{{ actor }}'
AND time_period = '{{ time_period }}'
AND activity_type = '{{ activity_type }}'
;