Aspen
Estimate the energy use, carbon emissions and water consumption of your GitHub Actions, for one repository or a whole organisation.
What Aspen does
CI runs in data centres, and most GitHub hosted runners are in the US, where the grid still relies heavily on fossil fuels. Free minutes cost you nothing, but the electricity they use still emits carbon and consumes water.
Aspen takes the minutes your workflows ran on each type of runner, plus the storage they used, and turns them into three figures:
- Energyin watt hours, from the estimated power draw of each runner type and the data centre overhead (PUE)
- Carbonin grams of CO2 equivalent, using the average carbon intensity of the US grid
- Waterin litres, for data centre cooling and for generating the electricity
It writes them to a JSON report, a markdown summary in the job page (totals per repository, per workflow and per runner) and an optional badge for your README.
Aspen estimates from durations and runner types; it does not measure energy on the runner. For measured figures per step, look at eco-ci-energy-estimation.
Two ways to get the data
Aspen can read the usage from two sources. Both cover the same period, the last 30 days by default, so their figures can be compared.
jobs default
Reads the jobs of this repository's workflow runs through the Actions API.
- Works with the built-in
GITHUB_TOKEN, no secret to set up - Breaks the emissions down per workflow file
- Durations are rounded up to whole minutes and the runner type is inferred from labels such as
ubuntu-latest - Storage, self hosted and larger runners are not estimated
Start here. The badge is silver.
billing
Reads the organisation's billing report, the data GitHub invoices.
- Minutes as billed and runner types from the billing SKU, so it is the more precise of the two
- Includes Actions and Packages storage
- No per workflow breakdown, as the billing API does not expose it
- Needs an organisation token with
Administration(read), which can see the billing of every repository
In a workflow, the report is filtered to the current repository. Run the command line tool to cover the whole organisation. The badge is gold.
Add it to a workflow
Save this as .github/workflows/carbon.yml. It runs every Monday, adds the summary to the job page, publishes the badge to a badges branch and keeps the JSON report as an artifact. The action downloads a prebuilt binary and checks its SHA-256 checksum, so there is no build step.
name: Carbon estimate
on:
schedule:
- cron: '0 6 * * 1'
workflow_dispatch:
permissions:
actions: read
contents: write # to publish the badge on the `badges` branch
jobs:
estimate:
runs-on: ubuntu-latest
steps:
- uses: DigitalPebble/aspen@v1
id: aspen
with:
publish_badge: true
- uses: actions/upload-artifact@v4
with:
name: carbon-estimate
path: ${{ steps.aspen.outputs.report-path }}
To use the billing source instead, pass an organisation token stored as a secret:
- uses: DigitalPebble/aspen@v1
with:
source: billing
github_token: ${{ secrets.ORG_BILLING_TOKEN }}
publish_badge: true
badge_path: badge-billing.json
The billing token can read the billing data of the whole organisation, including private repositories. Read the security considerations before using it, especially in a public repository.
All the inputs and outputs of the action are listed in the README.
Show a badge
With publish_badge: true, the action commits a shields.io endpoint file with the emissions over the period to the badges branch. Add it to your README, replacing OWNER/REPO with your repository:
[](https://aspen.digitalpebble.com/)
This is what it looks like for Aspen itself, with the jobs source then the billing one:
The badge only works for public repositories, since shields.io cannot read a branch of a private one.
Bringing the numbers down
- Skip runs that are not needed, with
pathsorpaths-ignorefilters and aconcurrencygroup withcancel-in-progress. - Use ARM runners such as
ubuntu-24.04-armwhere your code supports it. In Aspen's model they draw 6.66 W against 11.52 W for x86. - Cache dependencies and build outputs.
- Run your own runners in a region with a low carbon intensity, such as Sweden or France.
The methodology explains where every figure comes from and what Aspen does not estimate.