Automatically post cloud cost reports with savings insights, budget tracking, and carbon footprint to your Pull Requests.
- Cost Health Score — A-F grade showing your cloud cost health at a glance
- Savings Opportunities — Top optimization insights ranked by potential savings
- Budget Tracking — Burn rate, projections, and overrun alerts
- Carbon Footprint — Environmental impact of your cloud usage
- Multi-Cloud — AWS, Azure, and GCP support
name: CloudExpat Cost Report
on:
pull_request:
workflow_dispatch:
permissions:
pull-requests: write
jobs:
cost-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: CloudExpat/cost-report@v1
with:
api-key: ${{ secrets.CLOUDEXPAT_API_KEY }}That's it! The action will post a cost report comment on every PR.
## ☁️ CloudExpat Cost Report
**Cost Health: C** · $4.3K/wk · ↑12.4% · 3 savings opportunities ($890/mo)
<details>
<summary>💰 Cost Summary ($4.3K this week, +$470 vs last week)</summary>
| Account | Provider | This Week | Change |
|---------|----------|----------:|-------:|
| Production | AWS | $3200.00 | +8.2% |
| Staging | Azure | $780.00 | +28.1% ⚠️ |
| Analytics | GCP | $300.00 | -2.0% |
</details>
<details>
<summary>🔍 Top Savings Opportunities — $890/mo potential</summary>
| # | Issue | Resource | Savings | Priority |
|---|-------|----------|--------:|----------|
| 1 | Oversized Instances | `i-0abc123` (m5.2xlarge) | $420/mo | 🔴 High |
| 2 | Dev/Test Always-On | `i-0def456` | $310/mo | 🟡 Medium |
| 3 | Unattached EBS Volumes | `vol-0789abc` | $160/mo | 🟡 Medium |
[View all insights →](https://app.cloudexpat.com/dashboard/optimization)
</details>
<details>
<summary>📊 Budget Status — $34,200 / $50,000 (68%)</summary>
**Monthly Budget**: $34,200 of $50,000 used (68.4%)
**Burn Rate**: $1,710/day · **Projected**: $51,200 (+$1,200 over budget)
**Days Remaining**: 12
</details>
<details>
<summary>🌱 Carbon Footprint (331 kgCO2e, +7.1%)</summary>
| Account | Current | Change |
|---------|--------:|-------:|
| Production | 245 kgCO2e | +11.4% |
| Staging | 34 kgCO2e | -10.5% |
| Analytics | 52 kgCO2e | +2.0% |
</details>- Log in to CloudExpat
- Go to Settings > API Keys
- Click Create API Key
- Copy the key (starts with
ce_live_)
- In your GitHub repository, go to Settings > Secrets and variables > Actions
- Click New repository secret
- Name:
CLOUDEXPAT_API_KEY - Value: Paste your API key
Create .github/workflows/cloudexpat.yml with the usage example above.
Create .cloudexpat.yml in your repo root to scope reports to a specific service:
service: payments-api
tags:
service: payments
environment: production| Input | Description | Required | Default |
|---|---|---|---|
api-key |
Your CloudExpat API key | Yes | - |
api-url |
API URL (for testing) | No | https://data.cloudexpat.com |
post-comment |
Post as PR comment | No | true |
service |
Service name to scope the report | No | - |
tags |
Resource tags to filter (format: key:value,key:value) |
No | - |
config-file |
Path to .cloudexpat.yml |
No | .cloudexpat.yml |
| Output | Description |
|---|---|
report-file |
Path to the generated report file |
success |
Whether the report was fetched successfully |
- uses: CloudExpat/cost-report@v1
with:
api-key: ${{ secrets.CLOUDEXPAT_API_KEY }}
service: payments-api- uses: CloudExpat/cost-report@v1
with:
api-key: ${{ secrets.CLOUDEXPAT_API_KEY }}
tags: 'environment:production,team:platform'on:
schedule:
- cron: '0 9 * * 1' # Weekly on Monday 9am UTCon:
push:
branches: [main]- uses: CloudExpat/cost-report@v1
with:
api-key: ${{ secrets.CLOUDEXPAT_API_KEY }}
post-comment: 'false'# Service name — scopes the report to resources tagged with this service
service: my-service
# Tag filters — only include resources matching these tags
tags:
environment: production
team: platformAdd the CLOUDEXPAT_API_KEY secret to your repository settings.
Your API key is invalid or expired. Generate a new one at app.cloudexpat.com.
No cloud accounts connected. Add at least one AWS, Azure, or GCP account in CloudExpat.
Ensure your workflow has pull-requests: write permission.
Insights are generated after CloudExpat analyzes your resources. This happens automatically within 24 hours of connecting a cloud account.
- Store API keys only in GitHub Secrets
- The action requires minimal permissions (
pull-requests: write) - Revoke API keys anytime from the CloudExpat dashboard
Note on Fork PRs: GitHub does not expose secrets to workflows triggered by PRs from forks. This action will only post comments on PRs from branches within the same repository.
MIT License - see LICENSE for details.