11name : Test
22
33on :
4- workflow_run :
5- workflows : [Release Beta]
6- types :
7- - completed
4+ pull_request :
85
96env :
107 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118 TERRAFORM_VERSION : " 1.4.6"
129 TF_WORKSPACE : " testing"
13- USE_BETA_VERSION : " true"
1410 COMMENTER_DEBUG : " true"
1511 GH_ACCEPT_HEADER : " Accept: application/vnd.github+json"
1612 GH_AUTH_HEADER : " Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"
1713 GH_API_VERSION : " X-GitHub-Api-Version: 2022-11-28"
1814 GH_COMMENT_URL : https://api.github.com/repos/GetTerminus/terraform-pr-commenter/issues/${{ github.event.number }}/comments
15+ TESTING : " false" # set to false when finished testing
1916
2017jobs :
2118 set-outputs :
2219 name : Set Outputs
23- if : ${{ github.event.workflow_run.conclusion == 'success' }}
2420 runs-on : ubuntu-latest
2521 outputs :
2622 tf_fmt_fail : ${{ steps.file_outputs.outputs.tf_fmt_fail }}
2925 tf_plan_fail_partial : ${{ steps.file_outputs.outputs.tf_plan_fail_partial }}
3026 tf_plan_success_no_changes : ${{ steps.file_outputs.outputs.tf_plan_success_no_changes }}
3127 tf_plan_success_with_changes : ${{ steps.file_outputs.outputs.tf_plan_success_with_changes }}
28+ tf_plan_success_with_outputs : ${{ steps.file_outputs.outputs.tf_plan_success_with_outputs }}
3229 tf_plan_success_long : ${{ steps.file_outputs.outputs.tf_plan_success_long }}
3330 tf_validate_fail : ${{ steps.file_outputs.outputs.tf_validate_fail }}
31+ tflint_fail : ${{ steps.file_outputs.outputs.tflint_fail }}
3432 strategy :
3533 matrix :
3634 filenames :
@@ -40,15 +38,19 @@ jobs:
4038 - " tf_plan_fail_partial"
4139 - " tf_plan_success_no_changes"
4240 - " tf_plan_success_with_changes"
41+ - " tf_plan_success_with_outputs"
4342 - " tf_plan_success_long"
4443 - " tf_validate_fail"
44+ - " tflint_fail"
4545 steps :
4646 - uses : actions/checkout@v3
47+ if : ${{ env.TESTING == 'true' }}
4748 - name : Set Test Outputs
49+ if : ${{ env.TESTING == 'true' }}
4850 id : file_outputs
4951 run : |
5052 EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
51-
53+
5254 #have to truncate so we don't get an "argument list too long" error
5355 if [[ "${{ matrix.filenames }}" == "tf_plan_success_long" ]]; then
5456 OUTPUT=$(cat ./testing/text-files/${{ matrix.filenames }}.txt)
@@ -62,18 +64,18 @@ jobs:
6264 # To test other scenarios please change the below variables as necessary.
6365 commenter-test :
6466 name : Test Commenter
65- if : ${{ github.event.workflow_run.conclusion == 'success' }}
6667 runs-on : ubuntu-latest
6768 needs : set-outputs
6869 steps :
6970 - uses : actions/checkout@v3
71+ if : ${{ env.TESTING == 'true' }}
7072 - name : Test
71- uses : GetTerminus/terraform-pr-commenter@v3-beta
73+ if : ${{ env.TESTING == 'true' }}
74+ uses : GetTerminus/terraform-pr-commenter@v3-beta # set to your branch for testing and switch back to v3-beta when done.
7275 with :
7376 commenter_type : plan
7477 # Should only be setting commenter_input or commenter_plan_path (commenter_plan_path only for plan commenter type)
75- # commenter_input: ${{ needs.set-outputs.outputs.tf_plan_fail }}
76- commenter_plan_path : ./testing/text-files/tf_plan_success_with_changes.txt
77- commenter_exitcode : 1
78- terraform_version : ${{ env.TERRAFORM_VERSION }}
79- use_beta_version : ${{ env.USE_BETA_VERSION }}
78+ commenter_input : ${{ needs.set-outputs.outputs.tf_plan_success_with_outputs }}
79+ # commenter_plan_path: ./testing/text-files/tf_plan_success_with_outputs.txt
80+ commenter_exitcode : 2
81+ use_beta_version : " true"
0 commit comments