Skip to content

Commit 057f5f2

Browse files
author
Nate Smith
authored
Merge pull request cli#3432 from cli/actions-int64
use int64 explicitly in Actions support
2 parents 09b0981 + 8458c5f commit 057f5f2

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

pkg/cmd/run/list/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func TestListRun(t *testing.T) {
132132
Limit: 101,
133133
},
134134
stubs: func(reg *httpmock.Registry) {
135-
runID := 0
135+
var runID int64
136136
runs := []shared.Run{}
137137
for runID < 103 {
138138
runs = append(runs, shared.TestRun(fmt.Sprintf("%d", runID), runID, shared.InProgress, ""))

pkg/cmd/run/shared/shared.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type Run struct {
4848
Status Status
4949
Conclusion Conclusion
5050
Event string
51-
ID int
51+
ID int64
5252
HeadBranch string `json:"head_branch"`
5353
JobsURL string `json:"jobs_url"`
5454
HeadCommit Commit `json:"head_commit"`
@@ -78,15 +78,15 @@ func (r Run) CommitMsg() string {
7878
}
7979

8080
type Job struct {
81-
ID int
81+
ID int64
8282
Status Status
8383
Conclusion Conclusion
8484
Name string
8585
Steps Steps
8686
StartedAt time.Time `json:"started_at"`
8787
CompletedAt time.Time `json:"completed_at"`
8888
URL string `json:"html_url"`
89-
RunID int `json:"run_id"`
89+
RunID int64 `json:"run_id"`
9090
}
9191

9292
type Step struct {
@@ -123,7 +123,7 @@ func AnnotationSymbol(cs *iostreams.ColorScheme, a Annotation) string {
123123
}
124124

125125
type CheckRun struct {
126-
ID int
126+
ID int64
127127
}
128128

129129
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
179179
return filtered, nil
180180
}
181181

182-
func GetRunsByWorkflow(client *api.Client, repo ghrepo.Interface, limit, workflowID int) ([]Run, error) {
182+
func GetRunsByWorkflow(client *api.Client, repo ghrepo.Interface, limit int, workflowID int64) ([]Run, error) {
183183
path := fmt.Sprintf("repos/%s/actions/workflows/%d/runs", ghrepo.FullName(repo), workflowID)
184184
return getRuns(client, repo, path, limit)
185185
}

pkg/cmd/run/shared/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func updated() time.Time {
1616
return updated
1717
}
1818

19-
func TestRun(name string, id int, s Status, c Conclusion) Run {
19+
func TestRun(name string, id int64, s Status, c Conclusion) Run {
2020
return Run{
2121
Name: name,
2222
ID: id,

pkg/cmd/run/view/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func runView(opts *ViewOptions) error {
280280

281281
var artifacts []shared.Artifact
282282
if selectedJob == nil {
283-
artifacts, err = shared.ListArtifacts(httpClient, repo, strconv.Itoa(run.ID))
283+
artifacts, err = shared.ListArtifacts(httpClient, repo, strconv.FormatInt(int64(run.ID), 10))
284284
if err != nil {
285285
return fmt.Errorf("failed to get artifacts: %w", err)
286286
}

pkg/cmd/run/watch/watch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func watchRun(opts *WatchOptions) error {
136136
// clear entire screen
137137
fmt.Fprintf(out, "\x1b[2J")
138138

139-
annotationCache := map[int][]shared.Annotation{}
139+
annotationCache := map[int64][]shared.Annotation{}
140140

141141
duration, err := time.ParseDuration(fmt.Sprintf("%ds", opts.Interval))
142142
if err != nil {
@@ -166,7 +166,7 @@ func watchRun(opts *WatchOptions) error {
166166
return nil
167167
}
168168

169-
func renderRun(opts WatchOptions, client *api.Client, repo ghrepo.Interface, run *shared.Run, prNumber string, annotationCache map[int][]shared.Annotation) (*shared.Run, error) {
169+
func renderRun(opts WatchOptions, client *api.Client, repo ghrepo.Interface, run *shared.Run, prNumber string, annotationCache map[int64][]shared.Annotation) (*shared.Run, error) {
170170
out := opts.IO.Out
171171
cs := opts.IO.ColorScheme()
172172

pkg/cmd/workflow/list/list_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ func TestListRun(t *testing.T) {
148148
},
149149
stubs: func(reg *httpmock.Registry) {
150150
workflows := []shared.Workflow{}
151-
for flowID := 0; flowID < 103; flowID++ {
151+
var flowID int64
152+
for flowID = 0; flowID < 103; flowID++ {
152153
workflows = append(workflows, shared.Workflow{
153154
ID: flowID,
154155
Name: fmt.Sprintf("flow %d", flowID),

pkg/cmd/workflow/shared/shared.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type WorkflowState string
2424

2525
type Workflow struct {
2626
Name string
27-
ID int
27+
ID int64
2828
Path string
2929
State WorkflowState
3030
}

0 commit comments

Comments
 (0)