Skip to content

Commit

Permalink
IgnoreDrafts: Add a property to ignore drafts
Browse files Browse the repository at this point in the history
To reflect the oss-telia attribute, I kept the same name and behavior.
On our side, we need to trigger an event, even if the PR is on draft
state.
  • Loading branch information
Seraf authored and nderjung committed Oct 17, 2021
1 parent f9c228c commit bbc4591
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ The following parameters are used for the resource's `source` configuration:
| `skip_ssl` | No | `true` | `false` | Whether to skip SSL verification of the Github API. |
| `only_mergeable` | No | `true` | `false` | Whether to react to (non-)mergeable pull requests. |
| `states` | No | `["closed"]` | `["open"]` | The state of the pull request to react on. |
| `ignore_drafts` | No | `true` | `false` | Disable triggering of the resource if the pull request is in Draft status.

| `ignore_states` | No | `["open"]` | `[]` | The state of the pull request to not react on. |
| `labels` | No | `["bug"]` | `[]` | The labels of the pull request to react on. |
| `ignore_labels` | No | `["lifecycle/stale"]` | `[]` | The labels of the pull request not to react on. |
| `comments` | No | `["^ping$"]` | `[]` | The regular expressions of the latest comment to react on. |
| `commenter_association` | No | `["first_time_contributor", "first_timer"]` | `["all"]` | The comment author's relationship with the pull request's repository. Possible values include any of or any combination of `"collaborator"`, `"contributor"`, `"first_timer"`, `"first_time_contributor"`, `"member"`, `"owner"`, or `"all"`. |
| `ignore_comments` | No | `["ing$"]` | `[]` | The regular expressions of the latest comment not to react on. |
| `map_comment_meta` | No | `true` | `false` | Whether to map any regular expression keys and their corresponding values to the meta object provided in `in`. |
| `review_states` | No | `["commented", "changes_requested"]` | `[]` | The state of the review, any combination of `approved`, `changes_requeste` and/or `commented`. |
| `when` | No | `first` | `latest` | The comment or review to select, one of either `all`, `latest` or `first`. |
| `review_states` | No | `["commented", "changes_requested"]` | `[]` | The state of the review, any combination of `approved`, `changes_requeste` and/or `commented`. |
| `when` | No | `first` | `latest` | The comment or review to select, one of either `all`, `latest` or `first`. |

## Behaviour

Expand Down
1 change: 1 addition & 0 deletions actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type Source struct {
IgnoreStates []string `json:"ignore_states"`
IgnoreLabels []string `json:"ignore_labels"`
IgnoreComments []string `json:"ignore_comments"`
IgnoreDrafts bool `json:"ignore_drafts"`
}

// Version communicated with Concourse.
Expand Down
2 changes: 1 addition & 1 deletion actions/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func Check(req CheckRequest) (*CheckResponse, error) {
}

// Ignore drafts
if *pull.Draft {
if req.Source.IgnoreDrafts && *pull.Draft {
continue
}

Expand Down

0 comments on commit bbc4591

Please sign in to comment.