Skip to content

Implement support for actions runners - #1446

Merged
gmlewis merged 2 commits into
google:masterfrom
nightlark:actions-runners
Mar 3, 2020
Merged

gmlewis merged 2 commits into
google:masterfrom
nightlark:actions-runners

Conversation

@nightlark

@nightlark nightlark commented Mar 1, 2020 •

Copy link
Copy Markdown
Contributor

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

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread github/actions_runners.go Outdated
Filename *string `json:"filename,omitempty"`
}

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/applicatio/application/

Comment thread github/actions_runners.go Outdated
// 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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Comment thread github/actions_runners.go Outdated
return nil, nil, err
}

runnerApplicationDownloads := new([]RunnerApplicationDownload)

Copy link
Copy Markdown
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)

Comment thread github/actions_runners.go

// 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
Copy Markdown
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!

@nightlark nightlark Mar 1, 2020 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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!
😁

Comment thread github/actions_runners.go Outdated
// 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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Comment thread github/actions_runners.go Outdated
return nil, nil, err
}

runners := new([]Runner)

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Alright, suggested changes are made!

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

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.

@wesleimp wesleimp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👌

@gmlewis

gmlewis commented Mar 3, 2020

Copy link
Copy Markdown
Collaborator

Thank you, @wesleimp!
Merging.

@gmlewis
gmlewis merged commit 5a0c02d into google:master Mar 3, 2020
@nightlark

Copy link
Copy Markdown
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

gmlewis commented Mar 3, 2020

Copy link
Copy Markdown
Collaborator

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
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
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