Skip to content

Commit

Permalink
Merge branch 'main' into fix/schema/secret
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3rw3rk authored Nov 7, 2023
2 parents 3c06bac + ba41348 commit a947f9d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
3 changes: 3 additions & 0 deletions constants/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const (
// ActionRenamed defines the action for renaming a repository.
ActionRenamed = "renamed"

// ActionReopened defines the action for re-opening a pull request (or issue).
ActionReopened = "reopened"

// ActionSynchronize defines the action for the synchronizing of pull requests.
ActionSynchronize = "synchronize"

Expand Down
20 changes: 10 additions & 10 deletions yaml/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "openjdk:latest",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "openjdk:latest",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "plugins/docker:18.09",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -351,7 +351,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Name: "install",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -387,7 +387,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "openjdk:latest",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -423,7 +423,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "openjdk:latest",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -467,7 +467,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Name: "install",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -496,7 +496,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "openjdk:latest",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -525,7 +525,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Image: "openjdk:latest",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down Expand Up @@ -573,7 +573,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) {
Name: "install",
Pull: "always",
Ruleset: Ruleset{
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize"}},
If: Rules{Event: []string{"push", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened"}},
Matcher: "filepath",
Operator: "and",
},
Expand Down
3 changes: 2 additions & 1 deletion yaml/ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ func (r *Rules) UnmarshalYAML(unmarshal func(interface{}) error) error {
case constants.EventPull:
events = append(events,
constants.EventPull+":"+constants.ActionOpened,
constants.EventPull+":"+constants.ActionSynchronize)
constants.EventPull+":"+constants.ActionSynchronize,
constants.EventPull+":"+constants.ActionReopened)
case constants.EventComment:
events = append(events,
constants.EventComment+":"+constants.ActionCreated,
Expand Down
2 changes: 1 addition & 1 deletion yaml/ruleset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestYaml_Ruleset_UnmarshalYAML(t *testing.T) {
Tag: []string{"^refs/tags/(\\d+\\.)+\\d+$"},
},
Unless: Rules{
Event: []string{"deployment", "pull_request:opened", "pull_request:synchronize", "comment:created", "comment:edited", "schedule"},
Event: []string{"deployment", "pull_request:opened", "pull_request:synchronize", "pull_request:reopened", "comment:created", "comment:edited", "schedule"},
Path: []string{"foo.txt", "/foo/bar.txt"},
},
Matcher: "regexp",
Expand Down

0 comments on commit a947f9d

Please sign in to comment.