push

This page was generated based on Github’s Documentation. See our welcome page for context and details.

Github Event push #

Github Action Trigger #

source

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
pushNot applicableWhen 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 addedremoved, 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 #

source

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.

fieldtyperequireddescription
github.event.afterstringrequired

The SHA of the most recent commit on ref after the push.

github.event.base_refstring or nullrequired
github.event.beforestringrequired

The SHA of the most recent commit on ref before the push.

github.event.commitsarray of objectsrequired

An array of commit objects describing the pushed commits. (Pushed commits are all commits that are included in the compare between the before commit and the after commit.) The array includes a maximum of 2048 commits. If necessary, you can use the Commits API to fetch additional commits.

github.event.commits.addedarray of stringsoptional

An array of files added in the commit. A maximum of 3000 changed files will be reported per commit.

github.event.commits.authorobjectrequired

Metaproperties for Git author/committer information.

github.event.commits.author.datestringoptional
github.event.commits.author.emailstring or nullrequired
github.event.commits.author.namestringrequired

The git author’s name.

github.event.commits.author.usernamestringoptional
github.event.commits.committerobjectrequired

Metaproperties for Git author/committer information.

github.event.commits.committer.datestringoptional
github.event.commits.committer.emailstring or nullrequired
github.event.commits.committer.namestringrequired

The git author’s name.

github.event.commits.committer.usernamestringoptional
github.event.commits.distinctbooleanrequired

Whether this commit is distinct from any that have been pushed before.

github.event.commits.idstringrequired
github.event.commits.messagestringrequired

The commit message.

github.event.commits.modifiedarray of stringsoptional

An array of files modified by the commit. A maximum of 3000 changed files will be reported per commit.

github.event.commits.removedarray of stringsoptional

An array of files removed in the commit. A maximum of 3000 changed files will be reported per commit.

github.event.commits.timestampstringrequired

The ISO 8601 timestamp of the commit.

github.event.commits.tree_idstringrequired
github.event.commits.urlstringrequired

URL that points to the commit API resource.

github.event.comparestringrequired

URL that shows the changes in this ref update, from the before commit to the after commit. For a newly created ref that is directly based on the default branch, this is the comparison between the head of the default branch and the after commit. Otherwise, this shows all commits until the after commit.

github.event.createdbooleanrequired

Whether this push created the ref.

github.event.deletedbooleanrequired

Whether this push deleted the ref.

github.event.enterpriseobjectoptional

An enterprise on GitHub. Webhook payloads contain the enterprise property when the webhook is configured on an enterprise account or an organization that’s part of an enterprise account. For more information, see “About enterprise accounts."

github.event.forcedbooleanrequired

Whether this push was a force push of the ref.

github.event.head_commitobject or nullrequired
github.event.head_commit.addedarray of stringsoptional

An array of files added in the commit.

github.event.head_commit.authorobjectrequired

Metaproperties for Git author/committer information.

github.event.head_commit.author.datestringoptional
github.event.head_commit.author.emailstring or nullrequired
github.event.head_commit.author.namestringrequired

The git author’s name.

github.event.head_commit.author.usernamestringoptional
github.event.head_commit.committerobjectrequired

Metaproperties for Git author/committer information.

github.event.head_commit.committer.datestringoptional
github.event.head_commit.committer.emailstring or nullrequired
github.event.head_commit.committer.namestringrequired

The git author’s name.

github.event.head_commit.committer.usernamestringoptional
github.event.head_commit.distinctbooleanrequired

Whether this commit is distinct from any that have been pushed before.

github.event.head_commit.idstringrequired
github.event.head_commit.messagestringrequired

The commit message.

github.event.head_commit.modifiedarray of stringsoptional

An array of files modified by the commit.

github.event.head_commit.removedarray of stringsoptional

An array of files removed in the commit.

github.event.head_commit.timestampstringrequired

The ISO 8601 timestamp of the commit.

github.event.head_commit.tree_idstringrequired
github.event.head_commit.urlstringrequired

URL that points to the commit API resource.

github.event.installationobjectoptional

The GitHub App installation. Webhook payloads contain the installation property when the event is configured for and sent to a GitHub App. For more information, see “Using webhooks with GitHub Apps."

github.event.organizationobjectoptional

A GitHub organization. Webhook payloads contain the organization property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization.

github.event.pusherobjectrequired

Metaproperties for Git author/committer information.

github.event.pusher.datestringoptional
github.event.pusher.emailstring or nulloptional
github.event.pusher.namestringrequired

The git author’s name.

github.event.pusher.usernamestringoptional
github.event.refstringrequired

The full git ref that was pushed. Example: refs/heads/main or refs/tags/v3.14.1.

github.event.repositoryobjectrequired

A git repository

github.event.senderobjectoptional

The GitHub user that triggered the event. This property is included in every webhook payload.