Skip to content

Instantly share code, notes, and snippets.

@notpeter
Created March 12, 2025 16:31
Show Gist options
  • Save notpeter/d60b1f0cdb56ce3d61516af03ce62302 to your computer and use it in GitHub Desktop.
Save notpeter/d60b1f0cdb56ce3d61516af03ce62302 to your computer and use it in GitHub Desktop.
gha_azure_runner_size.yml
# Find the Azure hardware of your GitHub Hosted runners
# This assumes an organization runner called `windows-2025-64` update accordingly.
#
# Ouptput looks like:
# Run Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance/compute?api-version=2023-07-01" |
# {
# "vm_size": "Standard_D16ads_v5",
# "location": "eastus",
# "os_disk_gb": 600,
# "rs_disk_gb": 749.5
# }
# {
# "vCPUs": 16,
# "cpuid": "AMD EPYC 7763 64-Core Processor",
# "Cores": 8,
# "RamGb": 64.0
# }
name: Runner Check
on:
pull_request:
branches: [main]
jobs:
windows:
name: (Windows) Run Tests
runs-on: windows-2025-64
steps:
# Temporarily Collect some metadata about the hardware behind our runners.
- name: GHA Runner Info
run: |
Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance/compute?api-version=2023-07-01" |
ConvertTo-Json -Depth 10 |
jq "{ vm_size: .vmSize, location: .location, os_disk_gb: (.storageProfile.osDisk.diskSizeGB | tonumber), rs_disk_gb: (.storageProfile.resourceDisk.size | tonumber / 1024) }"
@{
Cores = (Get-CimInstance Win32_Processor).NumberOfCores
vCPUs = (Get-CimInstance Win32_Processor).NumberOfLogicalProcessors
RamGb = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 2)
cpuid = (Get-CimInstance Win32_Processor).Name.Trim()
} | ConvertTo-Json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment