|
68 | 68 | config_file: .checkov.yml |
69 | 69 | quiet: true |
70 | 70 |
|
| 71 | + - name: Publish Terraform CI summary |
| 72 | + if: ${{ success() }} |
| 73 | + run: | |
| 74 | + cat << EOF >> "$GITHUB_STEP_SUMMARY" |
| 75 | + # Terraform CI Summary |
| 76 | +
|
| 77 | + - Terraform version (matrix): \`${{ matrix.terraform_version }}\` |
| 78 | + - Format check: passed |
| 79 | + - Init (no backend): passed |
| 80 | + - Validate: passed |
| 81 | + - TFLint: passed |
| 82 | + - Security: tfsec + Checkov passed |
| 83 | +
|
| 84 | + All Terraform checks finished successfully for this run. |
| 85 | + EOF |
| 86 | +
|
| 87 | + - name: Comment on PR with Terraform CI result |
| 88 | + if: always() |
| 89 | + uses: actions/github-script@v7 |
| 90 | + with: |
| 91 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + script: | |
| 93 | + const conclusion = '${{ job.status }}'; |
| 94 | + const symbols = { success: '✅', failure: '❌', cancelled: '⚪️' }; |
| 95 | + const symbol = symbols[conclusion] || 'ℹ️'; |
| 96 | + const body = |
| 97 | + `${symbol} Terraform CI finished with status: **${conclusion}**\n\n` + |
| 98 | + `Terraform versions tested: 1.6.6, 1.8.5, 1.9.5.\n` + |
| 99 | + `See detailed results in the "Checks" tab.`; |
| 100 | + const pr = context.payload.pull_request; |
| 101 | + if (!pr) { |
| 102 | + core.info('No pull_request context, skipping comment.'); |
| 103 | + } else { |
| 104 | + await github.rest.issues.createComment({ |
| 105 | + owner: context.repo.owner, |
| 106 | + repo: context.repo.repo, |
| 107 | + issue_number: pr.number, |
| 108 | + body |
| 109 | + }); |
| 110 | + } |
| 111 | +
|
71 | 112 | - name: Comment on PR with Terraform CI result |
72 | 113 | if: always() |
73 | 114 | uses: actions/github-script@v7 |
|
0 commit comments