-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (51 loc) · 1.68 KB
/
infracost.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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