Skip to content

chore(deps): update actions/checkout action to v4 #53

chore(deps): update actions/checkout action to v4

chore(deps): update actions/checkout action to v4 #53

Workflow file for this run

name: terraform-plan
on:
pull_request:
paths:
- '.github/workflows/terraform-plan.yml'
- 'infrastructure/**'
env:
tf_actions_working_dir: infrastructure/gcp
terraform_version: 0.13.5
jobs:
plan:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.tf_actions_working_dir }}
steps:
- name: checkout
id: checkout_code
uses: actions/checkout@v4
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ env.terraform_version }}
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform Lint
uses: reviewdog/action-tflint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: 'true'
filter_mode: 'nofilter'
- name: Terraform Init
id: init
run: terraform init
continue-on-error: false
- name: Terraform Validate
id: validate
run: terraform validate -no-color
continue-on-error: false
- name: Terraform Plan
id: plan
run: terraform plan -no-color
continue-on-error: false
- uses: actions/[email protected]
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖${{ steps.validate.outputs.stdout }}
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`${process.env.PLAN}\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})