Skip to content

test workflow

test workflow #7

name: Test Module
on:
pull_request:
paths:
- '*.tf'
- 'tests/**'
- 'examples/terraform-test/**'
- '.github/workflows/terraform-test.yaml'
workflow_dispatch:
permissions:
contents: read
pull-requests: write
id-token: write
jobs:
test:
name: Run Terraform Tests
uses: oozou/.github/.github/workflows/terraform-test.yml@main
secrets: inherit
with:
aws_region: 'ap-southeast-1'
tf_version: '1.9.8'
go_version: '1.21'
test_example_path: 'examples/terraform-test'
timeout_minutes: 60
module_name: 'AWS ElastiCache'
iam_oidc_role: 'arn:aws:iam::562563527952:role/oozou-internal-devops-github-action-oidc-role' # oozou internal account
comment_on_failure:
name: Comment on PR if tests fail
runs-on: ubuntu-latest
needs: test
if: failure() && github.event_name == 'pull_request'
permissions:
pull-requests: write
steps:
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CICD_GH_PAT }}
script: |
const buildUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const comment = `@claude fix build error:
The Terraform tests have failed. Please check the build logs for details.
**Build Link:** ${buildUrl}
**Failed Job:** ${{ needs.test.result }}
Please review the test failures and fix any issues before merging.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});