Skip to content

Commit

Permalink
feat: optimize code logic
Browse files Browse the repository at this point in the history
Signed-off-by: yuluo-yx <[email protected]>
  • Loading branch information
yuluo-yx committed Apr 26, 2024
1 parent 83ecd09 commit 841ad00
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 11 additions & 5 deletions retest/retest.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,18 @@ func getPR(rt *Runtime) *PullRequest {

func getPRCommentContent(rt *Runtime) bool {

comment, response, err := githubClient.PullRequests.GetComment(
context.Background(),
rt.Owner,
rt.Repo,
rt.CommentId,
req, err := githubClient.NewRequest(
http.MethodGet,
fmt.Sprintf("/repos/%v/%v/issues/comments/%v", rt.Owner, rt.Repo, rt.CommentId),
nil,
)
if err != nil {
log.Fatal("failed to create request, error: ", err)
return false
}

var comment = &github2.IssueComment{}
response, err := githubClient.Do(context.Background(), req, comment)

if response.StatusCode != 200 && response.StatusCode != 201 && err != nil {

Expand Down
10 changes: 2 additions & 8 deletions retest/retest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func Test(t *testing.T) {
setup()

testInitRetestCommands_ExistEnvs(t)
testinitretestcommandsExistenvs(t)

teardown()
}
Expand All @@ -28,7 +28,7 @@ func teardown() {
os.Unsetenv("CI_DEBUG")
}

func testInitRetestCommands_ExistEnvs(t *testing.T) {
func testinitretestcommandsExistenvs(t *testing.T) {

rt := retest.InitRetestCommands()

Expand All @@ -38,9 +38,3 @@ func testInitRetestCommands_ExistEnvs(t *testing.T) {
assert.True(t, rt.Debug)

}

func testRuns(t *testing.T) {

rt := retest.InitRetestCommands()

}

0 comments on commit 841ad00

Please sign in to comment.