Skip to content

Commit

Permalink
refactor: use infracost CI scripts (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
alikhajeh1 authored Nov 25, 2020
1 parent 3951eee commit 27c74c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 111 deletions.
19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Infracost GitHub Action

This GitHub Action runs [Infracost](https://infracost.io) against the master branch and the pull request whenever a Terraform file changes. It automatically adds a pull request comment showing the cost estimate difference (similar to `git diff`) if a percentage threshold is crossed.
This GitHub Action runs [Infracost](https://infracost.io) against the master/main branch and the pull request whenever a Terraform file changes. It automatically adds a pull request comment showing the cost estimate difference (similar to `git diff`) if a percentage threshold is crossed.

This Action uses the latest version of Infracost by default as we continually add support for more cloud resources.

<img src="screenshot.png" width=557 alt="Example screenshot" />

Expand Down Expand Up @@ -52,13 +54,13 @@ If the [Terraform directory method](https://www.infracost.io/docs/#1-terraform-d

## Outputs

### `master_monthly_cost`
### `default_branch_monthly_cost`

The master branch's monthly cost estimate.
The default branch's monthly cost estimate.

### `pull_request_monthly_cost`
### `current_branch_monthly_cost`

The pull request's monthly cost estimate.
The current branch's monthly cost estimate.

## Usage

Expand All @@ -78,26 +80,20 @@ The pull request's monthly cost estimate.
runs-on: ubuntu-latest
name: Show infracost diff
steps:
- name: Checkout master branch
uses: actions/checkout@v2
with:
ref: master
path: master
- name: Checkout pull request branch
- name: Check out repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
path: pull_request
- name: Run infracost diff
uses: infracost/infracost-gh-action@master # Use a specific version if locking the GH Action version is preferred
uses: infracost/infracost-gh-action@master # Use a specific version instead of master if locking is preferred
env:
INFRACOST_API_KEY: ${{ secrets.INFRACOST_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Do not change
with:
entrypoint: /scripts/ci/diff.sh # Do not change
tfdir: PATH/TO/CODE
tfflags: -var-file=myvars.tfvars
percentage_threshold: 1
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ outputs:
description: The pull request's monthly cost estimate.
runs:
using: docker
image: Dockerfile
image: docker://infracost/infracost:latest # Use a specific version instead of latest if locking is preferred
args:
- ${{ inputs.tfjson }}
- ${{ inputs.tfplan }}
Expand Down
75 changes: 0 additions & 75 deletions entrypoint.sh

This file was deleted.

0 comments on commit 27c74c4

Please sign in to comment.