-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(github-bot): support review team flows (#3530)
Fixes #3072, Fixes #3093. Should add support for the required workflows on the GitHub bot, for the review team. cc @Kouteki @jefft0
- Loading branch information
Showing
14 changed files
with
516 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
GNOROOT_DIR ?= $(abspath $(lastword $(MAKEFILE_LIST))/../../../) | ||
|
||
rundep := go run -modfile ../../misc/devdeps/go.mod | ||
golangci_lint := $(rundep) github.com/golangci/golangci-lint/cmd/golangci-lint | ||
|
||
.PHONY: install | ||
install: | ||
go install . | ||
|
||
.PHONY: lint | ||
lint: | ||
$(golangci_lint) --config ../../.github/golangci.yml run ./... | ||
|
||
.PHONY: test | ||
test: | ||
go test $(GOTEST_FLAGS) -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package requirements | ||
|
||
import ( | ||
"github.com/gnolang/gno/contribs/github-bot/internal/utils" | ||
|
||
"github.com/google/go-github/v64/github" | ||
"github.com/xlab/treeprint" | ||
) | ||
|
||
// Draft Condition. | ||
type draft struct{} | ||
|
||
var _ Requirement = &draft{} | ||
|
||
func (*draft) IsSatisfied(pr *github.PullRequest, details treeprint.Tree) bool { | ||
return utils.AddStatusNode(pr.GetDraft(), "This pull request is a draft", details) | ||
} | ||
|
||
func Draft() Requirement { | ||
return &draft{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package requirements | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/gnolang/gno/contribs/github-bot/internal/utils" | ||
"github.com/google/go-github/v64/github" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/xlab/treeprint" | ||
) | ||
|
||
func TestDraft(t *testing.T) { | ||
t.Parallel() | ||
|
||
for _, testCase := range []struct { | ||
name string | ||
isMet bool | ||
}{ | ||
{"draft is true", true}, | ||
{"draft is false", false}, | ||
} { | ||
t.Run(testCase.name, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
pr := &github.PullRequest{Draft: &testCase.isMet} | ||
details := treeprint.New() | ||
req := Draft() | ||
|
||
assert.Equal(t, req.IsSatisfied(pr, details), testCase.isMet, fmt.Sprintf("condition should have a met status: %t", testCase.isMet)) | ||
assert.True(t, utils.TestLastNodeStatus(t, testCase.isMet, details), fmt.Sprintf("condition details should have a status: %t", testCase.isMet)) | ||
}) | ||
} | ||
} |
Oops, something went wrong.