-
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
feat: Add support for GitHub-hosted runner API endpoints #3487
base: master
Are you sure you want to change the base?
Conversation
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3487 +/- ##
==========================================
+ Coverage 91.02% 91.18% +0.15%
==========================================
Files 179 181 +2
Lines 15561 15863 +302
==========================================
+ Hits 14165 14464 +299
- Misses 1223 1225 +2
- Partials 173 174 +1 ☔ View full report in Codecov by Sentry. |
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, @atilsensalduz !
This is looking great!
There are a few minor tweaks, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
Implement new methods for managing GitHub-hosted runners, including functionalities for creating, updating, deleting, and retrieving details about hosted runners. References: - GitHub REST API: https://docs.github.com/en/rest/actions/hosted-runners Signed-off-by: atilsensalduz <[email protected]>
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, @atilsensalduz!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
@stevehipwell - might you have time for a code review? 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.
This looks great @atilsensalduz. My only question is about the distinction between the CreateHostedRunnerRequest
and UpdateHostedRunnerRequest
. AFAIK the idiom in the codebase is to use a single struct where possible so this differs from that pattern. Personally I like this pattern but I'm interested if @gmlewis has some overarching guidance here?
In this specific case the difference between the two models should be removed when the API catches up with the UI behaviour. So maybe a shared HostedRunnerRequest
struct with an error thrown if size is set for the update until the API supports it? Or maybe a comment in code to switch to aliases when the API matches. I guess the approach here probably comes back to the question above.
Good catch, @stevehipwell. We attempt to minimize the creation of extra structs and reuse similar structs for similar use cases with comments where necessary to explain usage. |
…add validation Unified the CreateHostedRunnerRequest and UpdateHostedRunnerRequest into a single HostedRunnerRequest struct. Added validation functions for HostedRunnerRequest. Signed-off-by: atilsensalduz <[email protected]>
@stevehipwell Thank you so much for the review and the excellent suggestion. I’ve implemented it along with the additional validations. I really appreciate your valuable input! |
…add validation Unified the CreateHostedRunnerRequest and UpdateHostedRunnerRequest into a single HostedRunnerRequest struct. Added validation functions for HostedRunnerRequest. Signed-off-by: atilsensalduz <[email protected]>
…add validation Unified the CreateHostedRunnerRequest and UpdateHostedRunnerRequest into a single HostedRunnerRequest struct. Added validation functions for HostedRunnerRequest. Signed-off-by: atilsensalduz <[email protected]>
@atilsensalduz - please run step 4 of CONTRIBUTING.md and make sure the linter and all tests pass locally, then push the changes to this PR. Thank you! |
Hey @gmlewis , yes, all tests passed locally. The workflow is showing a failure in the TestRepositoriesService_IsCollaborator_True test, which I didn't modify. I believe this might be a flaky test. Could you please rerun the workflow? I thought this was already a known issue, but if needed, I’d be happy to investigate and fix this flaky test |
Ah, very interesting! We've had some issues with GitHub Actions workflow runs lately, so if this is a flaky test it has probably been masked by these other issues... but more likely it was a GHA glitch. |
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, @atilsensalduz!
After a few tweaks, please, we should be ready for a second LGTM+Approval from any other contributor to this repo.
func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request *HostedRunnerRequest) (*HostedRunner, *Response, error) { | ||
err := validateCreateHostedRunnerRequest(request) | ||
if err != nil { | ||
return nil, nil, errors.New("validation failed: " + err.Error()) |
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.
return nil, nil, errors.New("validation failed: " + err.Error()) | |
return nil, nil, errors.New("validation failed: %w", err) |
func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { | ||
err := validateUpdateHostedRunnerRequest(&updateReq) | ||
if err != nil { | ||
return nil, nil, errors.New("validation failed: " + err.Error()) |
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.
return nil, nil, errors.New("validation failed: " + err.Error()) | |
return nil, nil, errors.New("validation failed: %w", err) |
err := validateCreateHostedRunnerRequest(request) | ||
if err != nil { |
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.
err := validateCreateHostedRunnerRequest(request) | |
if err != nil { | |
if err := validateCreateHostedRunnerRequest(request); err != nil { |
func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, request *HostedRunnerRequest) (*HostedRunner, *Response, error) { | ||
err := validateCreateHostedRunnerRequest(request) | ||
if err != nil { | ||
return nil, nil, errors.New("validation failed: " + err.Error()) |
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.
return nil, nil, errors.New("validation failed: " + err.Error()) | |
return nil, nil, errors.New("validation failed: %w", err) |
err := validateUpdateHostedRunnerRequest(&updateReq) | ||
if err != nil { |
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.
err := validateUpdateHostedRunnerRequest(&updateReq) | |
if err != nil { | |
if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { |
func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { | ||
err := validateUpdateHostedRunnerRequest(&updateReq) | ||
if err != nil { | ||
return nil, nil, errors.New("validation failed: " + err.Error()) |
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.
return nil, nil, errors.New("validation failed: " + err.Error()) | |
return nil, nil, errors.New("validation failed: %w", err) |
This pull request introduces support for the GitHub-hosted runner API endpoints in the go-github library, addressing Issue #3461.
Changes Include:
Additional Information:
API Reference: GitHub REST API: Hosted Runners.
Please let me know if any additional changes or improvements are needed!
Fixes: #3461.