-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement support for actions workflow jobs #1421
Conversation
Apparently I pasted the wrong test, I am sorry. |
Thanks, @joshuabezaleel!
Yes, I think this one should probably be treated like we treat GetArchiveLink where the client can either get the URL or get the actual text file using the Does that make sense? |
Yes, the function that you mentioned was really helpful, thank you very much @gmlewis !! Looking forward to your review 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @joshuabezaleel!
One tiny nit, otherwise LGTM.
Were you able to try this out to see if it worked?
I ask because I know we recently added a different followRedirectsClient
mechanism to RepositoriesService.DownloadReleaseAsset
and am not sure which is the better implementation, actually.
If it turns out you try this one and it doesn't work, then maybe we could try the other mechanism which I know was tested and might be a better solution.
Either way, awaiting second LGTM before merging.
github/actions_workflow_jobs.go
Outdated
return job, resp, nil | ||
} | ||
|
||
// GetWorkflowJobLogs gets a redirect URL to a download a plain text file of logs for a workflow job. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/to a download/to download/
probably you need to do go get github.com/google/go-github@thebranch-containing-the-code or you should add a replace in your go.mod replace github.com/google/go-github => ./the-path-to-your-checkout-of-the-repo-branch |
@marcofranssen The |
Can you please start with a super-simple example like this: #1176 (comment) I'm betting that you are trying to call |
github/actions_workflow_jobs.go
Outdated
} | ||
|
||
// Job represents a repository action workflow job. | ||
type Job struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I think about this, the more I'm thinking that all fields in Job
and Step
should be pointers and add the ,omitempty
tag, just for consistency with the rest of the repo.
I'd like to hear what @gauntface thinks about this, specifically.
Technically, I don't think they are needed... but it might be an odd experience for a user of this repo to find this pair of structs not follow the pattern set by the rest of the repo.
github/actions_workflow_jobs.go
Outdated
|
||
// Jobs represents a slice of repository action workflow job. | ||
type Jobs struct { | ||
TotalCount int `json:"total_count"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
TotalCount *int `json:"total_count,omitempty"`
github/actions_workflow_jobs.go
Outdated
StartedAt Timestamp `json:"started_at"` | ||
CompletedAt Timestamp `json:"completed_at"` | ||
Name string `json:"name"` | ||
Steps []*Step `json:"steps"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steps
would be the only exception and is fine as it is currently written, being a slice of pointers.
github/actions_workflow_jobs.go
Outdated
) | ||
|
||
// Step represents a single task from a sequence of tasks of a job. | ||
type Step struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In light of #1429, #79, #45, and #19, I'm going to make the executive decision and say that these two structs (Job
and Step
) should all use pointers.
In addition, please rename Step
to be TaskStep
to make it more clear when seeing it by itself.
And let's please change Job
to WorkflowJob
to make it more descriptive as well.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Friendly ping, @joshuabezaleel to switch these fields to pointers, please.
Thank you, @joshuabezaleel. |
Hi @gmlewis , I ran the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that if you accept my two suggestions, that the tests should be fixed.
I'm going to go ahead and try it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those commits fixed it. LGTM.
@wesleimp or @martinssipenko - if you could approve please, we can go ahead and merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Truly sorry for the hassle and thank you for fixing it up for me, @gmlewis ! Truly appreciate it 🙂 |
No problem, @joshuabezaleel - you did a great job, and it was my fault for waffling on the pointers. 😄 Thank you, @martinssipenko! |
This PR adds support for managing the most recent update of Action Workflow Jobs.
Relates to: #1399
By the way, there are several things that I am still not sure of:
ListWorkflowJobLogs
but since it basically retrieve a URL to download a text file that contain the logs I think it would be better to name itGetLogsFileURL
.go-github
would implement this particular function since the URL of the file is in the header of the response. Do you have any example of other functions that implement this kind of response?Thank you very much beforehand 🙂