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 #
Webhook event payload | Activity types | GITHUB_SHA | GITHUB_REF |
---|---|---|---|
branch_protection_rule | - created - edited - deleted | Last commit on default branch | Default 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 #
Activities: created
, deleted
, edited
Common Fields #
These fields are common to every event types available with this trigger.
field | type | required | description |
---|---|---|---|
github.event.enterprise | object | optional | An enterprise on GitHub. Webhook payloads contain the |
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.repository | object | required | The repository on GitHub where the event occurred. Webhook payloads contain the |
github.event.rule | object | required | The branch protection rule. Includes a |
github.event.rule.admin_enforced | boolean | required | |
github.event.rule.allow_deletions_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.allow_force_pushes_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.authorized_actor_names | array of strings | required | |
github.event.rule.authorized_actors_only | boolean | required | |
github.event.rule.authorized_dismissal_actors_only | boolean | required | |
github.event.rule.create_protected | boolean | optional | |
github.event.rule.created_at | string | required | |
github.event.rule.dismiss_stale_reviews_on_push | boolean | required | |
github.event.rule.id | integer | required | |
github.event.rule.ignore_approvals_from_contributors | boolean | required | |
github.event.rule.linear_history_requirement_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.merge_queue_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.name | string | required | |
github.event.rule.pull_request_reviews_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.repository_id | integer | required | |
github.event.rule.require_code_owner_review | boolean | required | |
github.event.rule.require_last_push_approval | boolean | optional | Whether the most recent push must be approved by someone other than the person who pushed it |
github.event.rule.required_approving_review_count | integer | required | |
github.event.rule.required_conversation_resolution_level | off , non_admins , everyone | required | |
github.event.rule.required_deployments_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.required_status_checks | array of strings | required | |
github.event.rule.required_status_checks_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.signature_requirement_enforcement_level | off , non_admins , everyone | required | |
github.event.rule.strict_required_status_checks_policy | boolean | required | |
github.event.rule.updated_at | string | required | |
github.event.sender | object | required | 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.
field | type | required | description |
---|---|---|---|
github.event.action | created | required |
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.
field | type | required | description |
---|---|---|---|
github.event.action | deleted | required |
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.
field | type | required | description |
---|---|---|---|
github.event.action | edited | required | |
github.event.changes | object | optional | If the action was |
github.event.changes.admin_enforced | object | optional | |
github.event.changes.admin_enforced.from | boolean or null | required | |
github.event.changes.authorized_actor_names | object | optional | |
github.event.changes.authorized_actor_names.from | array of strings | required | |
github.event.changes.authorized_actors_only | object | optional | |
github.event.changes.authorized_actors_only.from | boolean or null | required | |
github.event.changes.authorized_dismissal_actors_only | object | optional | |
github.event.changes.authorized_dismissal_actors_only.from | boolean or null | required | |
github.event.changes.linear_history_requirement_enforcement_level | object | optional | |
github.event.changes.linear_history_requirement_enforcement_level.from | off , non_admins , everyone | required | |
github.event.changes.required_status_checks | object | optional | |
github.event.changes.required_status_checks.from | array of strings | required | |
github.event.changes.required_status_checks_enforcement_level | object | optional | |
github.event.changes.required_status_checks_enforcement_level.from | off , non_admins , everyone | required |