Skip to content

Instantly share code, notes, and snippets.

@wenqiglantz
Last active November 12, 2022 05:16
Show Gist options
  • Save wenqiglantz/b96c1dacca9c05cf4cc8af98d18b5eaf to your computer and use it in GitHub Desktop.
Save wenqiglantz/b96c1dacca9c05cf4cc8af98d18b5eaf to your computer and use it in GitHub Desktop.
name: "Infracost analysis"
on:
# trigger only when PR is raised because infracost needs to compare two branches to get cost difference
pull_request:
branches: [ main ]
paths: 'terraform/**'
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
infracost:
permissions:
contents: write
pull-requests: write
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/terraform-infracost-pr.yml@latest
with:
terraform-var-file: ./.env/dev/terraform.tfvars
usage-file: ./.env/dev/infracost-usage.yml
secrets: inherit
send-email:
needs: infracost
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/send-email.yml@latest
with:
to: [email protected]
subject: ${{ github.repository }} Cloud Cost Report
body: Attached please find the cloud cost report generated by Infracost from worflow ${{ github.workflow }} of ${{ github.repository }}.
attachment-flag: true
attachments: report.html
secrets: inherit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment