Update testinput.yml #14
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: 'Terraform' | ||
# on: | ||
# push: | ||
# paths: | ||
# - '**.tf' | ||
# - '**.hcl' | ||
# - '**.tpl' | ||
# pull_request: | ||
# paths: | ||
# - '**.tf' | ||
# - '**.hcl' | ||
# - '**.tpl' | ||
# permissions: | ||
# contents: read | ||
# jobs: | ||
# terraform: | ||
# name: 'Terraform' | ||
# runs-on: ubuntu-latest | ||
# defaults: | ||
# run: | ||
# shell: bash | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@master | ||
# - name: Setup pnpm | ||
# uses: pnpm/action-setup@v4 | ||
# with: | ||
# version: 9 | ||
# - name: Install dependencies | ||
# run: pnpm install | ||
# - name: Setup go-task / task / taskfile | ||
# uses: rnorton5432/setup-task@v1 | ||
# - uses: 'google-github-actions/auth@v2' | ||
# with: | ||
# credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | ||
# # Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token | ||
# - name: Install Terraform | ||
# uses: hashicorp/setup-terraform@v3 | ||
# with: | ||
# terraform_version: "1.1.7" | ||
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. | ||
# Checks that all Terraform configuration files adhere to a canonical format | ||
# Generates an execution plan for Terraform | ||
- name: Terraform Init | ||
id: init | ||
if: github.event_name == 'pull_request' | ||
run: task terraform-init | ||
- name: Terraform Plan | ||
id: plan | ||
if: github.event_name == 'pull_request' | ||
run: task terraform-plan | ||
- name: Update Pull Request | ||
uses: actions/github-script@v6 | ||
if: github.event_name == 'pull_request' | ||
env: | ||
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | ||
with: | ||
result-encoding: string | ||
script: | | ||
const output = | ||
<details><summary>Show Plan</summary> | ||
\`\`\`\n | ||
${process.env.PLAN} | ||
\`\`\` | ||
</details> | ||
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: output | ||
}) | ||
# - name: Terraform Plan Merged | ||
# id: plan-merged | ||
# if: github.event.pull_request.merged == true | ||
# run: terraform plan -input=false -no-color | ||
# - name: Terraform Plan Status | ||
# if: steps.plan.outcome == 'failure' | ||
# run: exit 1 |