Merge pull request #23 from dasmeta/DMVP-5378-main-k8s-dashboard #48
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: | |
push: | |
branches: [main, master] | |
jobs: | |
terraform-validate: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: write | |
discussions: write | |
pull-requests: write | |
security-events: write | |
id-token: write | |
strategy: | |
matrix: | |
path: | |
- / | |
steps: | |
- name: Setup Infracost | |
uses: infracost/actions/setup@v2 | |
with: | |
api-key: ${{secrets.INFRACOST_API_KEY}} | |
- name: Checkout base branch | |
uses: actions/checkout@v3 | |
with: | |
ref: '${{ github.event.pull_request.base.ref }}' | |
- name: Generate Infracost cost estimate baseline | |
run: | | |
infracost breakdown --path=${{ matrix.path }} \ | |
--format=json \ | |
--out-file=/tmp/infracost-base.json | |
continue-on-error: true | |
- name: Checkout PR branch | |
uses: actions/checkout@v3 | |
- name: Generate Infracost diff | |
run: | | |
infracost diff --path=${{ matrix.path }}\ | |
--format=json \ | |
--compare-to=/tmp/infracost-base.json \ | |
--out-file=/tmp/infracost.json | |
continue-on-error: true | |
- 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 | |
continue-on-error: true |