From 2ea6970342d0e6b3baa2368f025621ddb88da2ff Mon Sep 17 00:00:00 2001 From: "Carlos Duarte Do Nascimento (Chester)" Date: Wed, 13 Oct 2021 15:41:46 +0000 Subject: [PATCH] Reintroduce branch_protection_rule actions trigger docs (also nixes some trailing spaces) --- .../events-that-trigger-workflows.md | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/content/actions/learn-github-actions/events-that-trigger-workflows.md b/content/actions/learn-github-actions/events-that-trigger-workflows.md index 6ea7d4c49a..328314c12d 100644 --- a/content/actions/learn-github-actions/events-that-trigger-workflows.md +++ b/content/actions/learn-github-actions/events-that-trigger-workflows.md @@ -62,7 +62,7 @@ Cron syntax has five fields separated by a space, and each field represents a un │ │ ┌───────────── day of the month (1 - 31) │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) -│ │ │ │ │ +│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * * * * * @@ -89,7 +89,7 @@ Notifications for scheduled workflows are sent to the user who last modified the ## Manual events -You can manually trigger workflow runs. To trigger specific workflows in a repository, use the `workflow_dispatch` event. To trigger more than one workflow in a repository and create custom events and event types, use the `repository_dispatch` event. +You can manually trigger workflow runs. To trigger specific workflows in a repository, use the `workflow_dispatch` event. To trigger more than one workflow in a repository and create custom events and event types, use the `repository_dispatch` event. ### `workflow_dispatch` @@ -190,6 +190,28 @@ You can configure your workflow to run when webhook events are generated on {% d Not all webhook events trigger workflows. For the complete list of available webhook events and their payloads, see "[Webhook events and payloads](/developers/webhooks-and-events/webhook-events-and-payloads)." +{% ifversion fpt or ghes > 3.2 or ghae-next %} +### `branch_protection_rule` + +Runs your workflow anytime the `branch_protection_rule` event occurs. {% data reusables.developer-site.multiple_activity_types %} For information about the GraphQL API, see "[BranchProtectionRule](/graphql/reference/objects#branchprotectionrule)." + +{% data reusables.github-actions.branch-requirement %} + +| Webhook event payload | Activity types | `GITHUB_SHA` | `GITHUB_REF` | +| --------------------- | -------------- | ------------ | -------------| +| [`branch_protection_rule`](/webhooks/event-payloads/#branch_protection_rule) | - `created`
- `edited`
- `deleted` | Last commit on default branch | Default branch | + +{% data reusables.developer-site.limit_workflow_to_activity_types %} + +For example, you can run a workflow when a branch protection rule has been `created` or `deleted`. + +```yaml +on: + branch_protection_rule: + types: [created, deleted] +``` +{% endif %} + ### `check_run` Runs your workflow anytime the `check_run` event occurs. {% data reusables.developer-site.multiple_activity_types %} For information about the REST API, see "[Check runs](/rest/reference/checks#runs)." @@ -589,7 +611,7 @@ Runs your workflow anytime the `pull_request` event occurs. {% data reusables.de {% note %} -**Notes:** +**Notes:** - By default, a workflow only runs when a `pull_request`'s activity type is `opened`, `synchronize`, or `reopened`. To trigger workflows for more activity types, use the `types` keyword. - Workflows will not run on `pull_request` activity if the pull request has a merge conflict. The merge conflict must be resolved first. @@ -808,7 +830,7 @@ on: workflow_run: workflows: ["Run Tests"] branches: [main] - types: + types: - completed - requested ```