Skip to content

Commit 211e670

Browse files
authored
Merge pull request #41894 from github/repo-sync
Repo sync
2 parents 94dda98 + bc9b3eb commit 211e670

File tree

31 files changed

+2475
-134
lines changed

31 files changed

+2475
-134
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Actions Cost Summary Script
2+
3+
The script can be found here: https://gist.github.com/docs-bot/98cb03ec43b716b1f8e03bcc091d069c.
4+
5+
This script processes GitHub Actions billing data to generate cost summaries by SKU (Stock Keeping Unit).
6+
7+
This script is referenced in the Billing tutorial: content/billing/tutorials/estimate-actions-costs.md
8+
9+
## Purpose
10+
11+
The script analyzes [summarized usage reports](https://docs.github.com/en/billing/reference/billing-reports#summarized-usage-report) from GitHub billing and creates CSV summaries that help you understand:
12+
13+
- Which Actions SKUs are being used
14+
- Total costs per SKU
15+
- Free minutes usage per SKU
16+
17+
Optionally, the script can generate per-organization breakdowns to analyze usage across different organizations.
18+
19+
## Requirements
20+
21+
- Python 3.x (uses only standard library modules)
22+
23+
## Use the script
24+
25+
### Basic usage
26+
27+
Generate a single SKU summary file:
28+
29+
```bash
30+
python3 summarize_actions_costs.py input_file.csv
31+
```
32+
33+
This creates `input_file_sku.csv` containing:
34+
- Each distinct SKU that starts with `actions_`
35+
- Sum of all costs (`net_amount`) for each SKU
36+
- Sum of free minutes used (where `net_amount` is 0) for each SKU
37+
38+
### Per-organization summaries
39+
40+
Generate both the SKU summary and individual files for each organization:
41+
42+
```bash
43+
python3 summarize_actions_costs.py input_file.csv --by-org
44+
```
45+
46+
This creates:
47+
- `input_file_sku.csv` - Overall SKU summary across all organizations
48+
- `input_file.organization_name.csv` - Individual summary for each organization
49+
50+
Each organization file contains the same SKU-level breakdown (costs and free minutes) but filtered to that specific organization's usage.
51+
52+
## Output format
53+
54+
All output CSV files have the following format:
55+
56+
```csv
57+
sku,total_net_amount,free_minutes_quantity
58+
actions_linux,10800.30,248594.00
59+
actions_macos,24424.38,10294.00
60+
...
61+
```
62+
63+
- **sku**: The SKU identifier (only those starting with `actions_`)
64+
- **total_net_amount**: Sum of all costs for this SKU
65+
- **free_minutes_quantity**: Sum of quantity used when no cost was incurred (free tier usage)
66+
67+
## Notes
68+
69+
- The script only processes rows where the `product` is `actions`
70+
- Only SKUs starting with `actions_` are included in the output
71+
- Organization names are sanitized for safe filenames (removes special characters, path separators, and limits length)
72+
- Empty organization names are saved as `unknown`
73+
- The script validates required CSV columns before processing
74+
- Malformed rows are skipped with a warning message
75+
- CSV injection protection is applied to output fields
76+
- Maximum of 1000 organizations when using `--by-org` to prevent resource exhaustion

content/actions/concepts/runners/self-hosted-runners.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@ topics:
1818
- CD
1919
---
2020

21+
{% data reusables.actions.self-hosted-price-note %}
22+
2123
A self-hosted runner is a system that you deploy and manage to execute jobs from {% data variables.product.prodname_actions %} on {% data variables.product.github %}.
2224

2325
Self-hosted runners:
2426

2527
{% ifversion fpt or ghec %}
26-
* Give you more control of hardware, operating system, and software tools than {% data variables.product.prodname_dotcom %}-hosted runners provide. Be aware that you are responsible for updating the operating system and all other software.{% endif %}
28+
* Give you more control of hardware, operating system, and software tools than {% data variables.product.github %}-hosted runners provide. Be aware that you are responsible for updating the operating system and all other software.
29+
* Allow you to use machines and services that your company already maintains and pays to use.{% endif %} {% ifversion actions-cloud-platform-march %}
30+
* Add little to your bill for actions usage because you pay only for using the actions cloud platform. See [AUTOTITLE](/billing/concepts/product-billing/github-actions).{% elsif fpt or ghec %}
31+
* Are currently free to use with {% data variables.product.prodname_actions %}. From {% data variables.actions.self_hosted_runner_charge_date %}, you will see a small per-minute charge for using the actions cloud platform in your bill for actions usage. See [AUTOTITLE](/billing/concepts/product-billing/github-actions).{% endif %} {% ifversion ghes %}
2732
* Are free to use with {% data variables.product.prodname_actions %}, but you are responsible for the cost of maintaining your runner machines.
33+
* Can use cloud services or local machines that you already pay for.{% endif %}
2834
* Let you create custom hardware configurations that meet your needs with processing power or memory to run larger jobs, install software available on your local network.
2935
* Receive automatic updates for the self-hosted runner application only, though you may disable automatic updates of the runner.
30-
* Can use cloud services or local machines that you already pay for.
3136
* Don't need to have a clean instance for every job execution.{% ifversion ghec or ghes %}
3237
* Can be organized into groups to restrict access to specific workflows, organizations, and repositories. See [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups).{% endif %}
3338
* Can be physical, virtual, in a container, on-premises, or in a cloud.

content/actions/how-tos/manage-runners/self-hosted-runners/add-runners.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Before you add a self-hosted runner, you should understand what they are and how
2929
Additionally, you must meet the following requirements:
3030
{% data reusables.actions.self-hosted-runners-prerequisites %}
3131

32+
{% data reusables.actions.self-hosted-price-note %}
33+
3234
## Adding a self-hosted runner to a repository
3335

3436
You can add self-hosted runners to a single repository. To add a self-hosted runner to a user repository, you must be the repository owner. For an organization repository, {% ifversion custom-org-roles %}you must be an organization owner, have admin access to the repository, or have the “Manage organization runners and runner groups” permission.{% else %}you must be an organization owner or have admin access to the repository.{% endif %}

content/actions/how-tos/manage-runners/self-hosted-runners/use-in-a-workflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ versions:
1515
ghec: '*'
1616
---
1717

18+
{% data reusables.actions.self-hosted-price-note %}
19+
1820
{% data reusables.actions.enterprise-github-hosted-runners %}
1921

2022
{% ifversion repository-actions-runners %}

content/actions/reference/runners/self-hosted-runners.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ versions:
1818
type: overview
1919
---
2020

21+
{% data reusables.actions.self-hosted-price-note %}
22+
2123
## Requirements for self-hosted runner machines
2224

2325
You can use a machine as a self-hosted runner as long as it meets these requirements:

content/actions/tutorials/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ children:
1010
- /create-an-example-workflow
1111
- /build-and-test-code
1212
- /authenticate-with-github_token
13+
- /migrate-to-github-runners
1314
- /create-actions
1415
- /publish-packages
1516
- /manage-your-work
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
title: 'Migrating from self-hosted runners to GitHub-hosted runners'
3+
intro: 'Learn how to assess your current CI infrastructure and migrate workflows from self-hosted runners to {% data variables.product.github %}-hosted runners.'
4+
shortTitle: 'Migrate to GitHub runners'
5+
versions:
6+
fpt: '*'
7+
ghec: '*'
8+
contentType: tutorials
9+
audience:
10+
- driver
11+
---
12+
13+
You can run workflows on {% data variables.product.github %}-hosted or self-hosted runners, or use a mixture of runner types.
14+
15+
This tutorial shows you how to assess your current use of runners, then migrate workflows from self-hosted runners to {% data variables.product.github %}-hosted runners efficiently.
16+
17+
## 1. Assess your current CI infrastructure
18+
19+
Migrating from self-hosted runners to {% data variables.product.github %}-hosted larger runners begins with a thorough assessment of your current CI infrastructure. If you take the time to match specifications and environments carefully, you will minimize the time spent fixing problems when you start running workflows on different runners.
20+
21+
1. Create an inventory of each machine specification used to run workflows, including CPU cores, RAM, storage, chip architecture, and operating system.
22+
1. Note if any of the runners are part of a runner group or have a label. You can use this information to simplify migration of workflows to new runners.
23+
1. Document any custom images and pre-installed dependencies that workflows rely on, as these will influence your migration strategy.
24+
1. Identify which workflows currently target self-hosted runners, and why. For example, in {% data variables.product.prodname_actions %} usage metrics, use the **Jobs** tab and filter by runner label (such as `self-hosted` or a custom label) to see which repositories and jobs are using that label. If you need to validate specific workflow files, you can also use code search to find workflow files that reference `runs-on: self-hosted` or other self-hosted labels.
25+
1. Identify workflows that access private network resources (for example, internal package registries, private APIs, databases, or on-premises services), since these may require additional networking configuration.
26+
27+
## 2. Map your processing requirements to {% data variables.product.github %}-hosted runner types
28+
29+
{% data variables.product.github %} offers managed runners in multiple operating systems—Linux, Windows, and macOS—with options for GPU-enabled machines. See [AUTOTITLE](/actions/reference/runners/larger-runners).
30+
31+
1. Map each distinct machine specification in your inventory to a suitable {% data variables.product.github %}-hosted runner specification.
32+
1. Make a note of any self-hosted runners where there is no suitable {% data variables.product.github %}-hosted runner.
33+
1. Exclude any workflows that must continue to run on self-hosted runners from your migration plans.
34+
35+
## 3. Estimate capacity requirements
36+
37+
Before you provision {% data variables.product.github %}-hosted runners, estimate how much compute capacity your workflows will need. Reviewing your current self-hosted runner usage helps you choose appropriate runner sizes, set concurrency limits, and forecast potential cost changes.
38+
39+
{% data reusables.profile.access_org %}
40+
{% data reusables.user-settings.access_org %}
41+
{% data reusables.organizations.insights %}
42+
1. In the "Insights" navigation menu, click **Actions Usage Metrics**.
43+
1. Click on the tab that contains the metrics you would like to view. See [AUTOTITLE](/actions/concepts/metrics).
44+
1. Review the following data points to estimate hosted runner capacity:
45+
46+
* **Total minutes consumed**: Helps you estimate baseline compute demand.
47+
* **Number of workflow runs**: Identifies peak activity times that may require more concurrency.
48+
* **Job distribution across OS types**: Ensures you provision the right mix of Linux, Windows, and macOS runners.
49+
* **Runner labels (Jobs tab)**: Filter by a runner label to understand where a label is used.
50+
51+
1. Convert your findings into a capacity plan:
52+
53+
* Match high-usage workflows to larger runner sizes where appropriate.
54+
* Identify workflows that may benefit from pre-built or custom images to reduce runtime.
55+
* Estimate concurrency by determining how many jobs typically run simultaneously.
56+
57+
1. Make a note of any gaps:
58+
59+
* Workflows with hard dependencies your current hosted runner images do not support.
60+
* Jobs with unusually long runtimes or bespoke environment needs. (You may need custom images for these.)
61+
62+
Your capacity plan will guide how many runners to provision, which machine types to use, and how to configure runner groups and policies in the next steps.
63+
64+
## 4. Configure runner groups and policies
65+
66+
After estimating your capacity needs, configure runner groups and access policies so your {% data variables.product.github %}-hosted runners are available to the right organizations and workflows.
67+
68+
Configuring runner groups before provisioning runners helps ensure that migration doesn’t accidentally open access too broadly or create unexpected cost increases.
69+
70+
1. Create runner groups at the enterprise level to define who can use your hosted runners. See [AUTOTITLE](/enterprise-cloud@latest/actions/how-tos/manage-runners/larger-runners/control-access#creating-a-runner-group-for-an-enterprise).
71+
72+
Use runner groups to scope access by organization, repository, or workflow. If you are migrating from self-hosted runners, consider reusing existing runner group names or labels where possible. This allows workflows to continue working without changes when you switch to {% data variables.product.github %}-hosted runners.
73+
74+
1. Add new {% data variables.product.github %}-hosted runners to the appropriate group and set concurrency limits based on the usage patterns you identified in step 3. For details on automatic scaling, see [AUTOTITLE](/actions/how-tos/manage-runners/larger-runners/manage-larger-runners#configuring-autoscaling-for-larger-runners).
75+
1. Review policy settings to ensure runners are only used by the intended workflows. For example, restricting use to specific repositories or preventing untrusted workflows from accessing more powerful machine types.
76+
77+
>[!NOTE] macOS larger runners cannot be added to runner groups and must be referenced directly in your workflow files.
78+
79+
## 5. Set up {% data variables.product.github %}-hosted runners
80+
81+
Next, provision your {% data variables.product.github %}-hosted runners based on the machine types and capacity you identified earlier.
82+
83+
1. Choose the machine size and operating system that match your workflow requirements. For available images and specifications, see [AUTOTITLE](/actions/reference/runners/larger-runners#runner-images).
84+
1. Assign each runner to a runner group and configure concurrency limits to control how many jobs can run at the same time.
85+
1. Select an image type:
86+
87+
* Use {% data variables.product.github %}-managed images for a maintained, frequently updated environment.
88+
* Use custom images when you need pre-installed dependencies to reduce setup time. See [AUTOTITLE](/actions/how-tos/manage-runners/larger-runners/use-custom-images).
89+
90+
1. Apply any required customizations, such as environment variables, software installation, or startup scripts. For more examples, see [AUTOTITLE](/actions/how-tos/manage-runners/github-hosted-runners/customize-runners).
91+
1. Optionally, configure private networking if runners must access internal resources. See [AUTOTITLE](/enterprise-cloud@latest/actions/concepts/runners/private-networking).
92+
93+
### Configure private connectivity options
94+
95+
If your workflows need access to private resources (for example, internal package registries, private APIs, databases, or on-premises services), choose an approach that fits your network and security requirements.
96+
97+
#### Configure Azure Private Networking
98+
99+
Run {% data variables.product.github %}-hosted runners inside an Azure Virtual Network (VNET) for secure access to internal resources.
100+
101+
1. Create an Azure Virtual Network (VNET) and configure subnets and network security groups for your runners.
102+
1. Enable Azure private networking for your runner group. See [AUTOTITLE](/admin/configuring-settings/configuring-private-networking-for-hosted-compute-products/configuring-private-networking-for-github-hosted-runners-in-your-enterprise#1-add-a-new-network-configuration-for-your-enterprise)
103+
1. Apply network configuration, such as NSGs and firewall rules, to control ingress and egress traffic.
104+
1. Update workflow targeting to use the runner group that is configured for private networking.
105+
106+
For detailed instructions, see:
107+
108+
* [AUTOTITLE](/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization)
109+
* [AUTOTITLE](/admin/configuring-settings/configuring-private-networking-for-hosted-compute-products/configuring-private-networking-for-github-hosted-runners-in-your-enterprise)
110+
111+
#### Connect using a WireGuard overlay network
112+
113+
If Azure private networking is not applicable (for example, because your target network is on-premises or in another cloud), you can use a VPN overlay such as WireGuard to provide network-level access to private resources.
114+
115+
For detailed instructions and examples, see [AUTOTITLE](/actions/how-tos/manage-runners/github-hosted-runners/connect-to-a-private-network/connect-with-wireguard).
116+
117+
#### Use OIDC with an API gateway for trusted access to private resources
118+
119+
If you don’t need the runner to join your private network, you can use OIDC to establish trusted, short-lived access to a service you expose via an API gateway. This approach can reduce the need for long-lived secrets and limits network access to the specific endpoints your workflow needs.
120+
121+
For detailed instructions and examples, see [AUTOTITLE](/actions/how-tos/manage-runners/github-hosted-runners/connect-to-a-private-network/connect-with-oidc).
122+
123+
## 6. Update workflows to use the new runners
124+
125+
After your {% data variables.product.github %}-hosted runners are configured, update your workflow files to target them.
126+
127+
1. Reuse existing labels if you assigned your new runners to the same runner group names your self-hosted runners used. In this case, workflows will automatically use the new runners without changes.
128+
1. If you created new runner groups or labels, update the runs-on field in your workflow YAML files. For example:
129+
130+
```yaml
131+
jobs:
132+
build:
133+
runs-on: [github-larger-runner, linux-x64]
134+
steps:
135+
- name: Checkout code
136+
uses: {% data reusables.actions.action-checkout %}
137+
- name: Build project
138+
run: make build
139+
```
140+
141+
1. Check for hard-coded references to self-hosted labels (such as `self-hosted`, `linux-x64`, or custom labels) and replace them with the appropriate {% data variables.product.github %}-hosted runner labels.
142+
1. Test each updated workflow to ensure it runs correctly on the new runners. Monitor for any issues related to environment differences or missing dependencies.
143+
144+
## 7. Remove unused self-hosted runners
145+
146+
After your workflows have been updated and tested on {% data variables.product.github %}-hosted runners, remove any self-hosted runners that are no longer needed. This prevents jobs from accidentally targeting outdated infrastructure. See [AUTOTITLE](/actions/how-tos/manage-runners/self-hosted-runners/remove-runners).
147+
148+
Before you remove self-hosted runners, verify that you have fully migrated:
149+
150+
* In {% data variables.product.prodname_actions %} usage metrics, use the **Jobs** tab and filter by runner label (for example, `self-hosted` or your custom labels) to confirm no repositories or jobs are still using self-hosted runners.

0 commit comments

Comments
 (0)