feat: add website public bucket #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Infracost | |
on: | |
pull_request: | |
paths: | |
- terraform/** | |
jobs: | |
infracost: | |
name: Infracost | |
runs-on: ubuntu-latest | |
env: | |
TF_ROOT: terraform/ | |
steps: | |
- name: Import Secrets | |
id: import_secrets | |
uses: hashicorp/[email protected] | |
with: | |
url: https://vault.basedosdados.org | |
token: ${{ secrets.VAULT_TOKEN }} | |
secrets: | | |
secret/data/terraform_credentials/basedosdados-dev INFRACOST_API_KEY | INFRACOST_API_KEY | |
- name: Setup Infracost | |
uses: infracost/actions/setup@v2 | |
with: | |
api-key: ${{ steps.import_secrets.outputs.INFRACOST_API_KEY }} | |
# Checkout the base branch of the pull request (e.g. main/master). | |
- name: Checkout base branch | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
# Generate Infracost JSON file as the baseline. | |
- name: Generate Infracost cost estimate baseline | |
run: | | |
infracost breakdown --path=${TF_ROOT} \ | |
--format=json \ | |
--out-file=/tmp/infracost-base.json \ | |
# Checkout the current PR branch so we can create a diff. | |
- name: Checkout PR branch | |
uses: actions/checkout@v2 | |
# Generate an Infracost diff and save it to a JSON file. | |
- name: Generate Infracost diff | |
run: | | |
infracost diff --path=${TF_ROOT} \ | |
--format=json \ | |
--compare-to=/tmp/infracost-base.json \ | |
--out-file=/tmp/infracost.json | |
# Posts a comment to the PR using the 'update' behavior. | |
# This creates a single comment and updates it. The "quietest" option. | |
# The other valid behaviors are: | |
# delete-and-new - Delete previous comments and create a new one. | |
# hide-and-new - Minimize previous comments and create a new one. | |
# new - Create a new cost estimate comment on every push. | |
# See https://www.infracost.io/docs/features/cli_commands/#comment-on-pull-requests for other options. | |
- name: Post Infracost comment | |
run: | | |
infracost comment github --path=/tmp/infracost.json \ | |
--repo=$GITHUB_REPOSITORY \ | |
--github-token=${{github.token}} \ | |
--pull-request=${{github.event.pull_request.number}} \ | |
--behavior=update |