Skip to content

feat: Add custom image endpoints for GitHub-hosted runners#4101

Open
austenstone wants to merge 4 commits intogoogle:masterfrom
austenstone:add-custom-image-endpoints
Open

feat: Add custom image endpoints for GitHub-hosted runners#4101
austenstone wants to merge 4 commits intogoogle:masterfrom
austenstone:add-custom-image-endpoints

Conversation

@austenstone
Copy link
Contributor

Summary

Add 6 new endpoints for managing custom images on GitHub-hosted runners, for both organization and enterprise levels.

New Endpoints

Organization (ActionsService)

Method HTTP Path
ListHostedRunnerCustomImages GET /orgs/{org}/actions/hosted-runners/images/custom
GetHostedRunnerCustomImage GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}
DeleteHostedRunnerCustomImage DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}
ListHostedRunnerCustomImageVersions GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions
GetHostedRunnerCustomImageVersion GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version}
DeleteHostedRunnerCustomImageVersion DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version}

Enterprise (EnterpriseService)

Same 6 endpoints under /enterprises/{enterprise}/...

New Types

  • HostedRunnerCustomImage — custom image definition (id, platform, name, source, versions_count, total_versions_size, latest_version, state)
  • HostedRunnerCustomImages — list wrapper
  • HostedRunnerCustomImageVersion — image version (version, size_gb, state, created_on)
  • HostedRunnerCustomImageVersions — list wrapper

API Docs

https://docs.github.com/en/rest/actions/hosted-runners?apiVersion=2026-03-10

Add 6 new endpoints for managing custom images on GitHub-hosted runners,
for both organization and enterprise levels:

- ListHostedRunnerCustomImages: GET .../hosted-runners/images/custom
- GetHostedRunnerCustomImage: GET .../hosted-runners/images/custom/{id}
- DeleteHostedRunnerCustomImage: DELETE .../hosted-runners/images/custom/{id}
- ListHostedRunnerCustomImageVersions: GET .../hosted-runners/images/custom/{id}/versions
- GetHostedRunnerCustomImageVersion: GET .../hosted-runners/images/custom/{id}/versions/{ver}
- DeleteHostedRunnerCustomImageVersion: DELETE .../hosted-runners/images/custom/{id}/versions/{ver}

New types: HostedRunnerCustomImage, HostedRunnerCustomImages,
HostedRunnerCustomImageVersion, HostedRunnerCustomImageVersions

Fixes #XXXX
…ustomImages not HostedRunnerCustomImageVersions
austenstone added a commit to austenstone/terraform-provider-github that referenced this pull request Mar 16, 2026
Add three new data sources for managing custom images on GitHub-hosted runners:

- github_actions_hosted_runner_custom_images: List all custom images for an org
- github_actions_hosted_runner_custom_image: Get a single custom image definition
- github_actions_hosted_runner_custom_image_versions: List versions of a custom image

WIP: Blocked on google/go-github#4101 merging. Currently uses raw HTTP calls
via the v3client to avoid a go-github version bump. Once the go-github PR
lands and is released, these can be migrated to typed SDK methods.

Includes acceptance tests, provider registration, and website docs.
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.70%. Comparing base (657976b) to head (e8a20cb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4101      +/-   ##
==========================================
+ Coverage   93.67%   93.70%   +0.03%     
==========================================
  Files         211      211              
  Lines       19478    19582     +104     
==========================================
+ Hits        18246    18350     +104     
  Misses       1034     1034              
  Partials      198      198              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis changed the title Add custom image endpoints for GitHub-hosted runners feat: Add custom image endpoints for GitHub-hosted runners Mar 17, 2026
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. labels Mar 17, 2026
@gmlewis
Copy link
Collaborator

gmlewis commented Mar 17, 2026

@austenstone - this one needs a linter cleanup before proceeding.

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, @austenstone!
Just a few tweaks, please, then awaiting a second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra - @munlicode

@munlicode
Copy link
Contributor

LGTM

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, @austenstone, @Not-Dhananjay-Mishra, and @munlicode!
LGTM.

@Not-Dhananjay-Mishra - do you approve now?

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Mar 17, 2026
Copy link
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra left a comment

Choose a reason for hiding this comment

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

Few small suggestion, otherwise LGMT 🚀

Comment on lines +182 to +187
type HostedRunnerCustomImageVersion struct {
Version *string `json:"version,omitempty"`
SizeGB *int `json:"size_gb,omitempty"`
State *string `json:"state,omitempty"`
StateDetails *string `json:"state_details,omitempty"`
CreatedOn *Timestamp `json:"created_on,omitempty"`
Copy link
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra Mar 17, 2026

Choose a reason for hiding this comment

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

Suggested change
type HostedRunnerCustomImageVersion struct {
Version *string `json:"version,omitempty"`
SizeGB *int `json:"size_gb,omitempty"`
State *string `json:"state,omitempty"`
StateDetails *string `json:"state_details,omitempty"`
CreatedOn *Timestamp `json:"created_on,omitempty"`
type HostedRunnerCustomImageVersion struct {
Version string `json:"version"`
SizeGB int `json:"size_gb"`
State string `json:"state"`
StateDetails string `json:"state_details"`
CreatedOn Timestamp `json:"created_on"`

Can we remove omitempty from required fields?

Comment on lines +165 to +172
ID *int64 `json:"id,omitempty"`
Platform *string `json:"platform,omitempty"`
Name *string `json:"name,omitempty"`
Source *string `json:"source,omitempty"`
VersionsCount *int `json:"versions_count,omitempty"`
TotalVersionsSize *int `json:"total_versions_size,omitempty"`
LatestVersion *string `json:"latest_version,omitempty"`
State *string `json:"state,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ID *int64 `json:"id,omitempty"`
Platform *string `json:"platform,omitempty"`
Name *string `json:"name,omitempty"`
Source *string `json:"source,omitempty"`
VersionsCount *int `json:"versions_count,omitempty"`
TotalVersionsSize *int `json:"total_versions_size,omitempty"`
LatestVersion *string `json:"latest_version,omitempty"`
State *string `json:"state,omitempty"`
ID int64 `json:"id"`
Platform string `json:"platform"`
Name string `json:"name"`
Source string `json:"source"`
VersionsCount int `json:"versions_count"`
TotalVersionsSize int `json:"total_versions_size"`
LatestVersion string `json:"latest_version"`
State string `json:"state"`

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants