GitHub Actions
Run Infracost in GitHub Actions to see cloud cost estimates and FinOps best practices in pull requests.
We recommend using the GitHub App where possible — it's simpler to set up and faster to run. Use this integration if your organization doesn't allow GitHub App installations.
Quick start
-
Install the Infracost CLI on your local machine.
-
From inside your Terraform, CloudFormation, or CDK project directory, run:
infracost ci setup --ci-pipelineThis walks you through connecting your account, generating the GitHub Actions workflow file, and configuring the secrets your repo needs to post PR comments.
-
Commit the generated workflow file and open a test pull request — see these steps for what to expect.
Migration guide
If you're running any version of the Infracost GitHub Action before 2.0.0, we recommend a clean migration rather than an in-place upgrade. We've distilled the lessons and best practices from years of running both the GitHub App and the previous CI/CD integrations into a much simpler approach — the workflow shape, action inputs, and required secrets have all changed as a result.
-
Remove the existing Infracost GitHub Action from your repository — delete the workflow file (typically
.github/workflows/infracost.yml) and any related steps in other workflows. -
From inside your Terraform, CloudFormation, or CDK project directory, run:
infracost ci setup --ci-pipelineThe
--ci-pipelineflag generates the new pipeline configuration directly, skipping the interactive setup options you don't need on a re-install. -
Fetch a new token when prompted. Existing tokens from older versions are not compatible — let the setup flow generate a fresh one rather than reusing your old
INFRACOST_API_KEY. -
Commit the new workflow file and open a test pull request to confirm the migration worked.