Skip to content

Test PR 1

Test PR 1 #11

Workflow file for this run

name: infra-main
on:
pull_request:
branches:
- infra_main
jobs:
infracost-pull-request-checks:
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
name: Infracost Pull Request Checks
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.11.0
- name: Terraform Init
run: |
cd infrastructure/terraform
terraform init
- name: Terraform plan
run: |
cd infrastructure/terraform
terraform plan -out .planfile
- name: Post PR comment
uses: borchero/terraform-plan-comment@v2
with:
token: ${{ github.token }}
planfile: ./infrastructure/terraform/planfile
header: 📝 Terraform Plan
- name: Setup Infracost
uses: infracost/actions/setup@v3
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}
# - name: Checkout base branch
# uses: actions/checkout@v4
# with:
# ref: '${{ github.event.pull_request.base.ref }}'
- name: Generate Infracost cost estimate
run: |
infracost breakdown --path=infrastructure \
--format=json \
--out-file=/tmp/infracost.json
# - name: Checkout PR branch
# uses: actions/checkout@v4
# - name: Generate Infracost diff
# run: |
# infracost diff --path=. \
# --format=json \
# --compare-to=/tmp/infracost-base.json \
# --out-file=/tmp/infracost.json
- 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