Skip to content

Use Node.js v20, bump most deps, support OpenTofu #110

Use Node.js v20, bump most deps, support OpenTofu

Use Node.js v20, bump most deps, support OpenTofu #110

Workflow file for this run

name: Test
on:
pull_request:
branches:
- master
- 'v*'
jobs:
test-action: # make sure the action works on a clean machine without building
name: Test normal PR use
runs-on: ubuntu-latest
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
- run: terraform init
working-directory: __tests__
- run: terraform plan -out test-plan.tfplan
working-directory: __tests__
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: __tests__
terraform-plan-file: test-plan.tfplan
test-action-plan-in-diff-dir: # make sure the action works with plan in different directory from working dir
name: Test TF plan in different dir
runs-on: ubuntu-latest
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
- run: terraform init
working-directory: __tests__
- run: terraform plan -out ../test-plan.tfplan
working-directory: __tests__
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: __tests__
terraform-plan-file: ../test-plan.tfplan
comment-title: Terraform Plan in different dir
test-action-without-tf-wrapper: # make sure the action works without the terraform wrapper
name: Test without TF wrapper
runs-on: ubuntu-latest
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
terraform_wrapper: false
- run: terraform init
working-directory: __tests__
- run: terraform plan -out test-plan.tfplan
working-directory: __tests__
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: __tests__
terraform-plan-file: test-plan.tfplan
comment-title: Terraform Plan without wrapper
test-action-at-root: # make sure the action works with terraform dir as root dir
name: Test from Root
runs-on: ubuntu-latest
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v4
- run: mv __tests__/* .
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
- run: terraform init
- run: terraform plan -out test-plan.tfplan
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
terraform-plan-file: test-plan.tfplan
comment-title: Terraform Plan from root
tofu: # make sure the action works when using tofu
name: Test tofu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.0
- run: tofu init
working-directory: __tests__
- run: tofu plan -out test-plan.tfplan
working-directory: __tests__
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: __tests__
terraform-plan-file: test-plan.tfplan