GitHub Action for C3X cloud cost estimation.
name: Cost Estimation
on: [pull_request]
permissions:
pull-requests: write
contents: read
jobs:
c3x:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: c3xdev/setup-c3x@v1
with:
path: .That's it. Every PR gets a cost estimate comment. No API key, no secrets.
Install the C3X Cloud app on your repository. Comments will appear as C3X Cloud with the C3X logo instead of the generic github-actions bot. No configuration needed.
- uses: c3xdev/setup-c3x@v1
with:
path: .
version: "1.0.1"Omit the path input to install the CLI without running estimation:
- uses: c3xdev/setup-c3x@v1
id: c3x
- run: c3x estimate --path . --format json --out-file estimate.json
- run: c3x comment github --path estimate.json --github-token ${{ steps.c3x.outputs.token }} --repo ${{ github.repository }} --pull-request ${{ github.event.pull_request.number }}| Input | Description | Default |
|---|---|---|
version |
C3X version to install | latest |
path |
Path to Terraform directory. When set, runs estimation and posts a PR comment. | |
show-all-projects |
Show all projects in the comment | true |
| Output | Description |
|---|---|
token |
GitHub token for c3x comment. Branded if C3X Cloud app is installed. |
When path is set on a pull request:
- Installs the C3X CLI (cached across runs)
- Gets a branded token from C3X Cloud (if the app is installed)
- Checks out the base branch and estimates costs
- Checks out the PR branch and diffs against the base
- Posts a cost comment on the PR
Apache-2.0