branch_protection_rule

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

Github Event branch_protection_rule #

Github Action Trigger #

source

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
branch_protection_rulecreated
edited
deleted
Last commit on default branchDefault branch

Note: More than one activity type triggers this event. For information about each activity type, see “Webhook events and payloads.” By default, all activity types trigger workflows that run on this event. You can limit your workflow runs to specific activity types using the types keyword. For more information, see “Workflow syntax for GitHub Actions.”

Note: This event will only trigger a workflow run if the workflow file is on the default branch.

Runs your workflow when branch protection rules in the workflow repository are changed. For more information about branch protection rules, see “About protected branches.” For information about the branch protection rule APIs, see “Objects” in the GraphQL API documentation or “REST API endpoints for branches and their settings.”

For example, you can run a workflow when a branch protection rule has been created or deleted:

on:
  branch_protection_rule:
    types: [created, deleted]

Event Payload #

source

Activities: created, deleted, edited

Common Fields #

These fields are common to every event types available with this trigger.
fieldtyperequireddescription
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.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.repositoryobjectrequired

The repository on GitHub where the event occurred. Webhook payloads contain the repository property when the event occurs from activity in a repository.

github.event.ruleobjectrequired

The branch protection rule. Includes a name and all the branch protection settings applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of off, non_admins, or everyone. Actor and build lists are arrays of strings.

github.event.rule.admin_enforcedbooleanrequired
github.event.rule.allow_deletions_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.allow_force_pushes_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.authorized_actor_namesarray of stringsrequired
github.event.rule.authorized_actors_onlybooleanrequired
github.event.rule.authorized_dismissal_actors_onlybooleanrequired
github.event.rule.create_protectedbooleanoptional
github.event.rule.created_atstringrequired
github.event.rule.dismiss_stale_reviews_on_pushbooleanrequired
github.event.rule.idintegerrequired
github.event.rule.ignore_approvals_from_contributorsbooleanrequired
github.event.rule.linear_history_requirement_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.merge_queue_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.namestringrequired
github.event.rule.pull_request_reviews_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.repository_idintegerrequired
github.event.rule.require_code_owner_reviewbooleanrequired
github.event.rule.require_last_push_approvalbooleanoptional

Whether the most recent push must be approved by someone other than the person who pushed it

github.event.rule.required_approving_review_countintegerrequired
github.event.rule.required_conversation_resolution_leveloff, non_admins, everyonerequired
github.event.rule.required_deployments_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.required_status_checksarray of stringsrequired
github.event.rule.required_status_checks_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.signature_requirement_enforcement_leveloff, non_admins, everyonerequired
github.event.rule.strict_required_status_checks_policybooleanrequired
github.event.rule.updated_atstringrequired
github.event.senderobjectrequired

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

created #

This event occurs when there is activity relating to branch protection rules. For more information, see "About protected branches." For information about the APIs to manage branch protection rules, see the GraphQL documentation or "Branch protection" in the REST API documentation.

To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission.

fieldtyperequireddescription
github.event.actioncreatedrequired

deleted #

This event occurs when there is activity relating to branch protection rules. For more information, see "About protected branches." For information about the APIs to manage branch protection rules, see the GraphQL documentation or "Branch protection" in the REST API documentation.

To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission.

fieldtyperequireddescription
github.event.actiondeletedrequired

edited #

This event occurs when there is activity relating to branch protection rules. For more information, see "About protected branches." For information about the APIs to manage branch protection rules, see the GraphQL documentation or "Branch protection" in the REST API documentation.

To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission.

fieldtyperequireddescription
github.event.actioneditedrequired
github.event.changesobjectoptional

If the action was edited, the changes to the rule.

github.event.changes.admin_enforcedobjectoptional
github.event.changes.admin_enforced.fromboolean or nullrequired
github.event.changes.authorized_actor_namesobjectoptional
github.event.changes.authorized_actor_names.fromarray of stringsrequired
github.event.changes.authorized_actors_onlyobjectoptional
github.event.changes.authorized_actors_only.fromboolean or nullrequired
github.event.changes.authorized_dismissal_actors_onlyobjectoptional
github.event.changes.authorized_dismissal_actors_only.fromboolean or nullrequired
github.event.changes.linear_history_requirement_enforcement_levelobjectoptional
github.event.changes.linear_history_requirement_enforcement_level.fromoff, non_admins, everyonerequired
github.event.changes.required_status_checksobjectoptional
github.event.changes.required_status_checks.fromarray of stringsrequired
github.event.changes.required_status_checks_enforcement_levelobjectoptional
github.event.changes.required_status_checks_enforcement_level.fromoff, non_admins, everyonerequired