test workflow #7
This file contains hidden or 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: 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 | |
}); |