Skip to content

Commit

Permalink
💸 cost: Adds infracost workflow, app hasn't been working well
Browse files Browse the repository at this point in the history
  • Loading branch information
bendoerr committed Aug 22, 2024
1 parent 7f78a6a commit 9e66862
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/infracost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Infracost

on:
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened ]

permissions:
contents: read

jobs:
report:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

steps:
- uses: infracost/actions/setup@e9d6e6cd65e168e76b0de50ff9957d2fe8bb1832 # v3.0.1
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}

# Checkout the base branch of the pull request (e.g. main/master).
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: '${{ github.event.pull_request.base.ref }}'

- run: |
infracost breakdown --config-file=./.infracost.yml \
--format=json \
--out-file=/tmp/infracost-base.json
# Checkout the current PR branch so we can create a diff.
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# Generate an Infracost diff and save it to a JSON file.
- run: |
infracost diff --config-file=./.infracost.yml \
--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.
- run: |
infracost comment github --path=/tmp/infracost.json \
--repo=$GITHUB_REPOSITORY \
--github-token=${{github.token}} \
--pull-request=${{github.event.pull_request.number}} \
--behavior=update \
--show-skipped

0 comments on commit 9e66862

Please sign in to comment.