Skip to content

Commit

Permalink
feat(rulesets): explain PR labeled and unlabeled events (#405)
Browse files Browse the repository at this point in the history
* Add PR labeled and unlabeled event info

* Add PR labeling examples
  • Loading branch information
wsan3 committed Jun 24, 2024
1 parent 48f4c4a commit 9bd2a58
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 16 deletions.
8 changes: 6 additions & 2 deletions content/reference/api/admin/secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ existing entry for the secret.
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down Expand Up @@ -116,7 +118,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
4 changes: 3 additions & 1 deletion content/reference/api/repo/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
16 changes: 12 additions & 4 deletions content/reference/api/repo/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down Expand Up @@ -132,7 +134,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down Expand Up @@ -239,7 +243,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down Expand Up @@ -286,7 +292,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
4 changes: 3 additions & 1 deletion content/reference/api/repo/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
4 changes: 3 additions & 1 deletion content/reference/api/repo/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
4 changes: 3 additions & 1 deletion content/reference/api/secret/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
8 changes: 6 additions & 2 deletions content/reference/api/secret/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down Expand Up @@ -118,7 +120,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
4 changes: 3 additions & 1 deletion content/reference/api/secret/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
4 changes: 3 additions & 1 deletion content/reference/api/secret/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ curl \
"opened": false,
"edited": false,
"synchronize": false,
"reopened": false
"reopened": false,
"labeled": false,
"unlabeled": false
},
"deployment": {
"created": true
Expand Down
22 changes: 20 additions & 2 deletions content/reference/yaml/steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ The following rules can be used to configure a ruleset:
| `branch` | name of branch for a build. |
| `comment` | pull request comment body. |
| `event` | name of an event for a build. |
| `label` | pull request label. |
| `path` | path to workspace files for a build. |
| `repo` | name of the repo for a build. |
| `status` | name of status for a build. |
Expand Down Expand Up @@ -164,7 +165,8 @@ steps:
# edited for comment. To specify an action, use a ":" as shown below.
event: [pull_request:opened, comment:created]

# Note: specifying pull_request is the same as [pull_request:opened, pull_request:synchronized].
# Note: specifying pull_request is the same as
# [pull_request:opened, pull_request:synchronized, pull_request:reopened].
# Specifying comment is the same as [comment:created, comment:edited].
```

Expand All @@ -179,10 +181,26 @@ If you wish to include _all_ event types from an event, you can specify a wildca

```yaml
ruleset:
event: pull_request* # will run on opened, reopened, synchronize, and edited
event: pull_request* # will run on opened, reopened, synchronize, edited, labeled, and unlabeled
```
{{% /alert %}}

```yaml
---
steps:
- name: Labeling a pull request
ruleset:
# This step will execute if a pull request has been labeled enhancement.
event: [ 'pull_request:labeled' ]
label: [ 'enhancement' ]
- name: Editing a pull request with labels
ruleset:
# This step will execute if a pull request has been edited AND
# has the labels enhancement or documentation.
event: [ 'pull_request:edited' ]
label: [ 'enhancement', 'documentation' ]
```

```yaml
---
steps:
Expand Down
2 changes: 2 additions & 0 deletions content/usage/repo_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Vela can subscribe to any of the following webhook events:
| `pull_request:reopened` | a pull request is reopened |
| `pull_request:synchronize` | a pull request source branch has been updated with a new commit |
| `pull_request:edited` | a pull request has been edited (title, description, target branch, etc) |
| `pull_request:labeled` | a pull request has been labeled |
| `pull_request:unlabeled` | a pull request has been unlabeled |
| `deployment:created` | a deployment is created for the repository |
| `comment:created` | a comment has been made on a pull request |
| `comment:edited` | a comment has been edited on a pull request |
Expand Down

0 comments on commit 9bd2a58

Please sign in to comment.