MCPcopy Create free account
hub / github.com/cli/cli / checksRun

Function checksRun

pkg/cmd/pr/checks/checks.go:148–254  ·  view source on GitHub ↗
(opts *ChecksOptions)

Source from the content-addressed store, hash-verified

146}
147
148func checksRun(opts *ChecksOptions) error {
149 if opts.WebMode {
150 return checksRunWebMode(opts)
151 }
152
153 findOptions := shared.FindOptions{
154 Selector: opts.SelectorArg,
155 Fields: []string{"number", "headRefName"},
156 }
157
158 var pr *api.PullRequest
159 pr, repo, findErr := opts.Finder.Find(findOptions)
160 if findErr != nil {
161 return findErr
162 }
163
164 client, clientErr := opts.HttpClient()
165 if clientErr != nil {
166 return clientErr
167 }
168
169 var checks []check
170 var counts checkCounts
171 var err error
172 var includeEvent bool
173
174 if opts.Detector == nil {
175 opts.Detector = fd.NewCachedDetector(client, repo.RepoHost(), time.Hour*24)
176 }
177 if features, featuresErr := opts.Detector.PullRequestFeatures(); featuresErr != nil {
178 return featuresErr
179 } else {
180 includeEvent = features.CheckRunEvent
181 }
182
183 checks, counts, err = populateStatusChecks(client, repo, pr, opts.Required, includeEvent)
184 if err != nil {
185 return err
186 }
187
188 if opts.Exporter != nil {
189 return opts.Exporter.Write(opts.IO, checks)
190 }
191
192 if opts.Watch {
193 opts.IO.StartAlternateScreenBuffer()
194 } else {
195 // Only start pager in non-watch mode
196 if err := opts.IO.StartPager(); err == nil {
197 defer opts.IO.StopPager()
198 } else {
199 fmt.Fprintf(opts.IO.ErrOut, "failed to start pager: %v\n", err)
200 }
201 }
202
203 // Do not return err until we can StopAlternateScreenBuffer()
204 for {
205 if counts.Pending != 0 && opts.Watch {

Callers 2

Test_checksRunFunction · 0.85
NewCmdChecksFunction · 0.85

Calls 15

checksRunWebModeFunction · 0.85
populateStatusChecksFunction · 0.85
printSummaryFunction · 0.85
StartPagerMethod · 0.80
StopPagerMethod · 0.80
RefreshScreenMethod · 0.80
ColorSchemeMethod · 0.80
BoldfMethod · 0.80
printTableFunction · 0.70
FindMethod · 0.65

Tested by 1

Test_checksRunFunction · 0.68