/
completed.go
46 lines (38 loc) · 1.21 KB
/
completed.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2018 The WPT Dashboard Project. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package summaries
import (
"github.com/google/go-github/v47/github"
"github.com/web-platform-tests/wpt.fyi/shared"
)
// ResultsComparison is all the fields shared across summaries that
// involve a result comparison.
type ResultsComparison struct {
BaseRun shared.TestRun
HeadRun shared.TestRun
MasterDiffURL string
DiffURL string // URL for the diff-view of the results
HostURL string // Host environment URL, e.g. "https://wpt.fyi"
}
// Completed is the struct for completed.md.
type Completed struct {
CheckState
ResultsComparison
Results BeforeAndAfter
More int
}
// GetCheckState returns the info needed to update a check.
func (c Completed) GetCheckState() CheckState {
return c.CheckState
}
// GetSummary executes the template for the data.
func (c Completed) GetSummary() (string, error) {
return compile(&c, "completed.md")
}
// GetActions returns the actions that can be taken by the user.
func (c Completed) GetActions() []*github.CheckRunAction {
return []*github.CheckRunAction{
RecomputeAction(),
}
}