Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scm): process reopened action for pull request event #1002

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions compiler/template/starlark/testdata/build/large/want.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -112,7 +112,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -168,7 +168,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -224,7 +224,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -280,7 +280,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -336,7 +336,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -392,7 +392,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -448,7 +448,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -504,7 +504,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -560,7 +560,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -616,7 +616,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -672,7 +672,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -728,7 +728,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -784,7 +784,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -840,7 +840,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down Expand Up @@ -896,7 +896,7 @@ stages:
steps:
- ruleset:
if:
event: ['pull_request:opened', 'pull_request:synchronize']
event: ['pull_request:opened', 'pull_request:synchronize', 'pull_request:reopened']
matcher: filepath
operator: and
secrets:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/drone/envsubst v1.0.3
github.com/gin-gonic/gin v1.9.1
github.com/go-playground/assert/v2 v2.2.0
github.com/go-vela/types v0.22.0-rc1
github.com/go-vela/types v0.22.0-rc1.0.20231107155504-ba41348d0fa9
github.com/golang-jwt/jwt/v5 v5.0.0
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v56 v56.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/go-vela/types v0.22.0-rc1 h1:LfYw8jiWW0KCPyIple2y9L75a5Lae454FfEe0JssLi0=
github.com/go-vela/types v0.22.0-rc1/go.mod h1:ljNY36D6YkpObBbNF7Xslv3oxN4mGuQAwWhnnK/V06I=
github.com/go-vela/types v0.22.0-rc1.0.20231107155504-ba41348d0fa9 h1:9ime2uWyIe2xhMWINOPs6SCj7Rk6vSAOZ/VZ+STgwpw=
github.com/go-vela/types v0.22.0-rc1.0.20231107155504-ba41348d0fa9/go.mod h1:ljNY36D6YkpObBbNF7Xslv3oxN4mGuQAwWhnnK/V06I=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down
5 changes: 3 additions & 2 deletions scm/github/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ func (c *client) processPREvent(h *library.Hook, payload *github.PullRequestEven
return &types.Webhook{Hook: h}, nil
}

// skip if the pull request action is not opened, synchronize
// skip if the pull request action is not opened, synchronize, or reopened
if !strings.EqualFold(payload.GetAction(), "opened") &&
!strings.EqualFold(payload.GetAction(), "synchronize") {
!strings.EqualFold(payload.GetAction(), "synchronize") &&
!strings.EqualFold(payload.GetAction(), "reopened") {
return &types.Webhook{Hook: h}, nil
}

Expand Down
Loading