This page was generated based on Github’s Documentation. See our welcome page for context and details.
Github Event push
#
Github Action Trigger #
Webhook event payload | Activity types | GITHUB_SHA | GITHUB_REF |
---|---|---|---|
push | Not applicable | When you delete a branch, the SHA in the workflow run (and its associated refs) reverts to the default branch of the repository. | Updated ref |
Note: The webhook payload available to GitHub Actions does not include the added
, removed
, and modified
attributes in the commit
object. You can retrieve the full commit object using the API. For information, see “Objects” in the GraphQL API documentation or “REST API endpoints for commits.”
Note: An event will not be created when you push more than three tags at once.
Runs your workflow when you push a commit or tag, or when you create a repository from a template.
For example, you can run a workflow when the push
event occurs.
on:
push
Note: When a push
webhook event triggers a workflow run, the Actions UI’s “pushed by” field shows the account of the pusher and not the author or committer. However, if the changes are pushed to a repository using SSH authentication with a deploy key, then the “pushed by” field will be the repository admin who verified the deploy key when it was added it to a repository.
Running your workflow only when a push to specific branches occurs #
You can use the branches
or branches-ignore
filter to configure your workflow to only run when specific branches are pushed. For more information, see “Workflow syntax for GitHub Actions.”
For example, this workflow will run when someone pushes to main
or to a branch that starts with releases/
.
on:
push:
branches:
- 'main'
- 'releases/**'
Note: If you use both the branches
filter and the paths
filter, the workflow will only run when both filters are satisfied. For example, the following workflow will only run when a push that includes a change to a JavaScript (.js
) file is made to a branch whose name starts with releases/
:
on:
push:
branches:
- 'releases/**'
paths:
- '**.js'
Running your workflow only when a push of specific tags occurs #
You can use the tags
or tags-ignore
filter to configure your workflow to only run when specific tags are pushed. For more information, see “Workflow syntax for GitHub Actions.”
For example, this workflow will run when someone pushes a tag that starts with v1.
.
on:
push:
tags:
- v1.**
Running your workflow only when a push affects specific files #
You can use the paths
or paths-ignore
filter to configure your workflow to run when a push to specific files occurs. For more information, see “Workflow syntax for GitHub Actions.”
For example, this workflow will run when someone pushes a change to a JavaScript file (.js
):
on:
push:
paths:
- '**.js'
Note: If you use both the branches
filter and the paths
filter, the workflow will only run when both filters are satisfied. For example, the following workflow will only run when a push that includes a change to a JavaScript (.js
) file is made to a branch whose name starts with releases/
:
on:
push:
branches:
- 'releases/**'
paths:
- '**.js'
Event Payload #
This event occurs when there is a push to a repository branch. This includes when a commit is pushed, when a commit tag is pushed,
when a branch is deleted, when a tag is deleted, or when a repository is created from a template. To subscribe to only branch
and tag deletions, use the delete
webhook event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission.
Note: An event will not be created when more than three tags are pushed at once.
field | type | required | description |
---|---|---|---|
github.event.after | string | required | The SHA of the most recent commit on |
github.event.base_ref | string or null | required | |
github.event.before | string | required | The SHA of the most recent commit on |
github.event.commits | array of objects | required | An array of commit objects describing the pushed commits. (Pushed commits are all commits that are included in the |
github.event.commits.added | array of strings | optional | An array of files added in the commit. A maximum of 3000 changed files will be reported per commit. |
github.event.commits.author | object | required | Metaproperties for Git author/committer information. |
github.event.commits.author.date | string | optional | |
github.event.commits.author.email | string or null | required | |
github.event.commits.author.name | string | required | The git author’s name. |
github.event.commits.author.username | string | optional | |
github.event.commits.committer | object | required | Metaproperties for Git author/committer information. |
github.event.commits.committer.date | string | optional | |
github.event.commits.committer.email | string or null | required | |
github.event.commits.committer.name | string | required | The git author’s name. |
github.event.commits.committer.username | string | optional | |
github.event.commits.distinct | boolean | required | Whether this commit is distinct from any that have been pushed before. |
github.event.commits.id | string | required | |
github.event.commits.message | string | required | The commit message. |
github.event.commits.modified | array of strings | optional | An array of files modified by the commit. A maximum of 3000 changed files will be reported per commit. |
github.event.commits.removed | array of strings | optional | An array of files removed in the commit. A maximum of 3000 changed files will be reported per commit. |
github.event.commits.timestamp | string | required | The ISO 8601 timestamp of the commit. |
github.event.commits.tree_id | string | required | |
github.event.commits.url | string | required | URL that points to the commit API resource. |
github.event.compare | string | required | URL that shows the changes in this |
github.event.created | boolean | required | Whether this push created the |
github.event.deleted | boolean | required | Whether this push deleted the |
github.event.enterprise | object | optional | An enterprise on GitHub. Webhook payloads contain the |
github.event.forced | boolean | required | Whether this push was a force push of the |
github.event.head_commit | object or null | required | |
github.event.head_commit.added | array of strings | optional | An array of files added in the commit. |
github.event.head_commit.author | object | required | Metaproperties for Git author/committer information. |
github.event.head_commit.author.date | string | optional | |
github.event.head_commit.author.email | string or null | required | |
github.event.head_commit.author.name | string | required | The git author’s name. |
github.event.head_commit.author.username | string | optional | |
github.event.head_commit.committer | object | required | Metaproperties for Git author/committer information. |
github.event.head_commit.committer.date | string | optional | |
github.event.head_commit.committer.email | string or null | required | |
github.event.head_commit.committer.name | string | required | The git author’s name. |
github.event.head_commit.committer.username | string | optional | |
github.event.head_commit.distinct | boolean | required | Whether this commit is distinct from any that have been pushed before. |
github.event.head_commit.id | string | required | |
github.event.head_commit.message | string | required | The commit message. |
github.event.head_commit.modified | array of strings | optional | An array of files modified by the commit. |
github.event.head_commit.removed | array of strings | optional | An array of files removed in the commit. |
github.event.head_commit.timestamp | string | required | The ISO 8601 timestamp of the commit. |
github.event.head_commit.tree_id | string | required | |
github.event.head_commit.url | string | required | URL that points to the commit API resource. |
github.event.installation | object | optional | The GitHub App installation. Webhook payloads contain the |
github.event.organization | object | optional | A GitHub organization. Webhook payloads contain the |
github.event.pusher | object | required | Metaproperties for Git author/committer information. |
github.event.pusher.date | string | optional | |
github.event.pusher.email | string or null | optional | |
github.event.pusher.name | string | required | The git author’s name. |
github.event.pusher.username | string | optional | |
github.event.ref | string | required | The full git ref that was pushed. Example: |
github.event.repository | object | required | A git repository |
github.event.sender | object | optional | The GitHub user that triggered the event. This property is included in every webhook payload. |