Merge pull request #3432 from cli/actions-int64

use int64 explicitly in Actions support
This commit is contained in:
Nate Smith 2021-04-19 13:22:49 -05:00 committed by GitHub
commit 057f5f2631
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 12 deletions

View file

@ -132,7 +132,7 @@ func TestListRun(t *testing.T) {
Limit: 101,
},
stubs: func(reg *httpmock.Registry) {
runID := 0
var runID int64
runs := []shared.Run{}
for runID < 103 {
runs = append(runs, shared.TestRun(fmt.Sprintf("%d", runID), runID, shared.InProgress, ""))

View file

@ -48,7 +48,7 @@ type Run struct {
Status Status
Conclusion Conclusion
Event string
ID int
ID int64
HeadBranch string `json:"head_branch"`
JobsURL string `json:"jobs_url"`
HeadCommit Commit `json:"head_commit"`
@ -78,7 +78,7 @@ func (r Run) CommitMsg() string {
}
type Job struct {
ID int
ID int64
Status Status
Conclusion Conclusion
Name string
@ -86,7 +86,7 @@ type Job struct {
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
URL string `json:"html_url"`
RunID int `json:"run_id"`
RunID int64 `json:"run_id"`
}
type Step struct {
@ -123,7 +123,7 @@ func AnnotationSymbol(cs *iostreams.ColorScheme, a Annotation) string {
}
type CheckRun struct {
ID int
ID int64
}
func GetAnnotations(client *api.Client, repo ghrepo.Interface, job Job) ([]Annotation, error) {
@ -179,7 +179,7 @@ func GetRunsWithFilter(client *api.Client, repo ghrepo.Interface, limit int, f f
return filtered, nil
}
func GetRunsByWorkflow(client *api.Client, repo ghrepo.Interface, limit, workflowID int) ([]Run, error) {
func GetRunsByWorkflow(client *api.Client, repo ghrepo.Interface, limit int, workflowID int64) ([]Run, error) {
path := fmt.Sprintf("repos/%s/actions/workflows/%d/runs", ghrepo.FullName(repo), workflowID)
return getRuns(client, repo, path, limit)
}

View file

@ -16,7 +16,7 @@ func updated() time.Time {
return updated
}
func TestRun(name string, id int, s Status, c Conclusion) Run {
func TestRun(name string, id int64, s Status, c Conclusion) Run {
return Run{
Name: name,
ID: id,

View file

@ -280,7 +280,7 @@ func runView(opts *ViewOptions) error {
var artifacts []shared.Artifact
if selectedJob == nil {
artifacts, err = shared.ListArtifacts(httpClient, repo, strconv.Itoa(run.ID))
artifacts, err = shared.ListArtifacts(httpClient, repo, strconv.FormatInt(int64(run.ID), 10))
if err != nil {
return fmt.Errorf("failed to get artifacts: %w", err)
}

View file

@ -136,7 +136,7 @@ func watchRun(opts *WatchOptions) error {
// clear entire screen
fmt.Fprintf(out, "\x1b[2J")
annotationCache := map[int][]shared.Annotation{}
annotationCache := map[int64][]shared.Annotation{}
duration, err := time.ParseDuration(fmt.Sprintf("%ds", opts.Interval))
if err != nil {
@ -166,7 +166,7 @@ func watchRun(opts *WatchOptions) error {
return nil
}
func renderRun(opts WatchOptions, client *api.Client, repo ghrepo.Interface, run *shared.Run, prNumber string, annotationCache map[int][]shared.Annotation) (*shared.Run, error) {
func renderRun(opts WatchOptions, client *api.Client, repo ghrepo.Interface, run *shared.Run, prNumber string, annotationCache map[int64][]shared.Annotation) (*shared.Run, error) {
out := opts.IO.Out
cs := opts.IO.ColorScheme()

View file

@ -148,7 +148,8 @@ func TestListRun(t *testing.T) {
},
stubs: func(reg *httpmock.Registry) {
workflows := []shared.Workflow{}
for flowID := 0; flowID < 103; flowID++ {
var flowID int64
for flowID = 0; flowID < 103; flowID++ {
workflows = append(workflows, shared.Workflow{
ID: flowID,
Name: fmt.Sprintf("flow %d", flowID),

View file

@ -24,7 +24,7 @@ type WorkflowState string
type Workflow struct {
Name string
ID int
ID int64
Path string
State WorkflowState
}