Skip to content

Commit

Permalink
Duplicate the check run even if we need to re-run the tests
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Orive <adrian.orive.oneca@gmail.com>
  • Loading branch information
Adirio committed Nov 19, 2020
1 parent 9ee83ec commit 0cd47d6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions verify/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (p PRPlugin) createCheckRun(client *github.Client, owner, repo, headSHA str
},
)
if err != nil {
return nil, fmt.Errorf("unable to submit check result: %w", err)
return nil, fmt.Errorf("unable to create check run: %w", err)
}

p.debugf("create check API response: %+v", res)
Expand All @@ -126,7 +126,7 @@ func (p PRPlugin) getCheckRun(client *github.Client, owner, repo, headSHA string
},
)
if err != nil {
return nil, err
return nil, fmt.Errorf("unable to list check runs: %w", err)
}

p.debugf("list check API response: %+v", res)
Expand Down Expand Up @@ -167,7 +167,7 @@ func (p PRPlugin) resetCheckRun(client *github.Client, owner, repo string, headS
},
)
if err != nil {
return checkRun, fmt.Errorf("unable to update check result: %w", err)
return checkRun, fmt.Errorf("unable to reset check run: %w", err)
}

p.debugf("update check API response: %+v", updateResp)
Expand All @@ -192,7 +192,7 @@ func (p PRPlugin) finishCheckRun(client *github.Client, owner, repo string, chec
},
})
if err != nil {
return fmt.Errorf("unable to update check result: %w", err)
return fmt.Errorf("unable to update check run with results: %w", err)
}

p.debugf("update check API response: %+v", updateResp)
Expand Down Expand Up @@ -222,7 +222,7 @@ func (p PRPlugin) duplicateCheckRun(client *github.Client, owner, repo, headSHA
},
)
if err != nil {
return nil, fmt.Errorf("unable to submit check result: %w", err)
return nil, fmt.Errorf("unable to create duplicate check run: %w", err)
}

p.debugf("create check API response: %+v", res)
Expand Down Expand Up @@ -318,7 +318,9 @@ func (p PRPlugin) onSync(env *ActionsEnv) error {
// Rerun the tests if they weren't finished
if !Finished.Equal(checkRun.GetStatus()) {
// Process the PR and submit the results
return p.processAndSubmit(env, checkRun)
if err = p.processAndSubmit(env, checkRun); err != nil {
return err
}
}

// Create a duplicate for the new commit
Expand Down

0 comments on commit 0cd47d6

Please sign in to comment.