Skip to content

Commit

Permalink
refactor: remove functions for checking and updating status
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersiddhu committed May 8, 2021
1 parent c4b3541 commit 3b80236
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions internal/app/comment/ontology.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,44 +171,3 @@ func listCommittedFiles(path string) ([]string, error) {
func baseNoSuffix(path string) string {
return strings.Split(filepath.Base(path), ".")[0]
}

func manageCheckStatus(args *checkStatusParams) error {
chresult, _, err := args.client.Checks.ListCheckRunsForRef(
context.Background(),
args.owner,
args.repository,
args.ref,
&github.ListCheckRunsOptions{
CheckName: github.String(args.report),
},
)
if err != nil {
return fmt.Errorf("error in listing check runs %s", err)
}
if chresult.GetTotal() < 1 {
return fmt.Errorf("should have at least one check status, got %d", chresult.GetTotal())
}
return updateCheckStatus(chresult.CheckRuns[0], args)
}

func updateCheckStatus(res *github.CheckRun, args *checkStatusParams) error {
concl := "success"
if _, ok := args.data["fail"]; ok {
concl = "failure"
}
_, _, err := args.client.Checks.UpdateCheckRun(
context.Background(),
args.owner,
args.repository,
res.GetID(),
github.UpdateCheckRunOptions{
Name: args.report,
Status: github.String("completed"),
Conclusion: github.String(concl),
},
)
if err != nil {
return fmt.Errorf("error in updating status check %s", err)
}
return nil
}

0 comments on commit 3b80236

Please sign in to comment.