Skip to content

Implement support for actions runners #1446

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

Merged
merged 2 commits into from
Mar 3, 2020

Conversation

nightlark
Copy link
Contributor

@nightlark nightlark commented Mar 1, 2020

This PR adds support for the GitHub Actions Runners API.

Relates to: #1399

For the list self hosted runners endpoint I sent an email to support regarding the example showing the array nested two levels deep which doesn't match the actual responses I was getting, and inquiring about if they intended to include a total_count field like most other endpoints that support pagination.

One of the things I'm not sure about is the return and struct field types, specifically which ones should be references (e.g. *[]Type or *[]*Type for a list return type, or something else?)

@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Mar 1, 2020
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, @nightlark!
Just a few minor tweaks, please, and then I think we will be ready for a second review and merging.

Filename *string `json:"filename,omitempty"`
}

// ListRunnerApplicationDownloads lists self-hosted runner applicatio binaries that can be downloaded and run.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/applicatio/application/

// ListRunnerApplicationDownloads lists self-hosted runner applicatio binaries that can be downloaded and run.
//
// GitHub API docs: https://developer.github.com/v3/actions/self_hosted_runners/#list-downloads-for-the-self-hosted-runner-application
func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) (*[]RunnerApplicationDownload, *Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/*[]Runner.../[]*Runner.../

return nil, nil, err
}

runnerApplicationDownloads := new([]RunnerApplicationDownload)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var rads []*RunnerApplicationDownload
resp, err := s.client.Do(ctx, req, &rads)


// ListRunners lists all the self-hosted runners for a repository.
//
// GitHub API docs: https://developer.github.com/v3/actions/self_hosted_runners/#list-self-hosted-runners-for-a-repository
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please contact [email protected] and ask them why their example shows a list-of-lists here:
https://developer.github.com/v3/actions/self_hosted_runners/#list-self-hosted-runners-for-a-repository
(and ask them to please fix it if it truly is a single list, which I think it should be)? Thank you!

Copy link
Contributor Author

@nightlark nightlark Mar 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s the bit in the description where I mentioned contacting support about the array nested two levels deep (the real endpoint response doesn’t match their example). I'm not sure if they'll respond until the week starts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whups, I have a bad habit of looking at the code before I look at the PR description.
Sorry about that, and thank you!
😁

// ListRunners lists all the self-hosted runners for a repository.
//
// GitHub API docs: https://developer.github.com/v3/actions/self_hosted_runners/#list-self-hosted-runners-for-a-repository
func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListOptions) (*[]Runner, *Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/*[]Runner/[]*Runner/

return nil, nil, err
}

runners := new([]Runner)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var runners []*Runner
resp, err := s.client.Do(ctx, req, &runners)

@gmlewis gmlewis requested a review from gauntface March 1, 2020 13:00
@nightlark
Copy link
Contributor Author

Alright, suggested changes are made!

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @nightlark !
LGTM. Awaiting second LGTM before merging.

Copy link
Collaborator

@wesleimp wesleimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👌

@gmlewis
Copy link
Collaborator

gmlewis commented Mar 3, 2020

Thank you, @wesleimp!
Merging.

@gmlewis gmlewis merged commit 5a0c02d into google:master Mar 3, 2020
@nightlark
Copy link
Contributor Author

Here’s the response from GitHub support on the list runners example:

You're right, it does look like that example response is incorrect. I've just created an issue for our documentation to get that fixed up. Sorry if that caused you any confusion!

@gmlewis
Copy link
Collaborator

gmlewis commented Mar 3, 2020

Thank you, @nightlark! As I said in another PR (heh, I think a lot of their reports come from volunteers working on this repo... which is why I delegate to avoid the "Oh, not gmlewis again!" 😄) reporting the errors in the official GitHub v3 API doc just helps to make a better experience for all users of GitHub, which is fantastic.

@nightlark nightlark deleted the actions-runners branch August 15, 2020 15:34
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants