Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
cloud-lightning

GitHub Action

Carbon Guard

v0.4.1

Carbon Guard

cloud-lightning

Carbon Guard

Prevent pipelines running at times of high carbon intensity

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Carbon Guard

uses: armakuni/carbon-guard@v0.4.1

Learn more about this action in armakuni/carbon-guard

Choose a version

Carbon Guard ๐Ÿ‘ฎ

We are taking the workload to carbon guard (to carbon guard) to carbon guard

Usage

poetry run carbon_guard --help
                                                                                
 Usage: carbon_guard [OPTIONS]                                                  
                                                                                
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *  --max-carbon-intensiโ€ฆ        INTEGER               Set the max carbon     โ”‚
โ”‚                                                       intensity in           โ”‚
โ”‚                                                       gCO2eq/kWh.            โ”‚
โ”‚                                                       [env var:              โ”‚
โ”‚                                                       MAX_CARBON_INTENSITY]  โ”‚
โ”‚                                                       [default: None]        โ”‚
โ”‚                                                       [required]             โ”‚
โ”‚    --data-source                [file|uk-carbon-inte  Where to read carbon   โ”‚
โ”‚                                 nsity]                intensity data from    โ”‚
โ”‚                                                       [env var:              โ”‚
โ”‚                                                       REPOSITORY_MODE]       โ”‚
โ”‚                                                       [default:              โ”‚
โ”‚                                                       uk-carbon-intensity]   โ”‚
โ”‚    --from-file-carbon-iโ€ฆ        PATH                  File to read carbon    โ”‚
โ”‚                                                       intensity from in file โ”‚
โ”‚                                                       mode                   โ”‚
โ”‚                                                       [env var:              โ”‚
โ”‚                                                       FROM_FILE_CARBON_INTEโ€ฆ โ”‚
โ”‚                                                       [default:              โ”‚
โ”‚                                                       .carbon_intensity]     โ”‚
โ”‚    --uk-carbon-intensitโ€ฆ        PARSE_URL             URL for the carbon     โ”‚
โ”‚                                                       intensity API          โ”‚
โ”‚                                                       [env var:              โ”‚
โ”‚                                                       UK_CARBON_INTENSITY_Aโ€ฆ โ”‚
โ”‚                                                       [default:              โ”‚
โ”‚                                                       https://api.carbonintโ€ฆ โ”‚
โ”‚    --help                                             Show this message and  โ”‚
โ”‚                                                       exit.                  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Examples

Examples for comparing current carbon intensity levels to global carbon intensity based on gCO2eq/kWh.

Comparing carbon levels with the expected outcome for high carbon intensity:

carbon_intensity_is 1000
poetry run carbon_guard --max-carbon-intensity=999
Carbon levels exceed threshold, skipping.

Comparing carbon levels with the expected outcome for low carbon intensity:

carbon_intensity_is 999
poetry run carbon_guard --max-carbon-intensity=999
Carbon levels under threshold, proceeding.

You may change the data source by specifying the --data-source flag.

poetry run carbon_guard --data-source uk-carbon-intensity --max-carbon-intensity=100000
Carbon levels under threshold, proceeding.