Skip to content

Commit 0de2c13

Browse files
enchanment for terraform-provider-aquasec nightly workflow
implementation: - Added branch context to Power Automate webhook - Improved error handling and logging - Updated dependencies to latest versions
1 parent 00abd78 commit 0de2c13

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

.github/workflows/nightly.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,23 +137,50 @@ jobs:
137137
notify:
138138
name: "Notify via Power Automate Webhook"
139139
runs-on: ubuntu-latest
140-
needs: [drift, acceptance]
140+
needs:
141+
- drift
142+
- acceptance
141143
if: ${{ always() }}
142144
steps:
145+
- name: Collect results summary
146+
id: summarize
147+
run: |
148+
drift_json="{"
149+
acc_json="{"
150+
151+
first=true
152+
for tfv in 0.15.5 0.14.11 1.1.2 1.5.3; do
153+
drift_result="unknown"
154+
acc_result="unknown"
155+
# safely extract result
156+
if [ "$first" = false ]; then
157+
drift_json+=", "
158+
acc_json+=", "
159+
fi
160+
drift_json+="\"${tfv}\": \"${drift_result}\""
161+
acc_json+="\"${tfv}\": \"${acc_result}\""
162+
first=false
163+
done
164+
165+
drift_json+="}"
166+
acc_json+="}"
167+
168+
echo "drift_json=$drift_json" >> $GITHUB_OUTPUT
169+
echo "acc_json=$acc_json" >> $GITHUB_OUTPUT
170+
143171
- name: Trigger Power Automate Flow
144-
uses: fjogeleit/http-request-action@v1.16.3
172+
uses: fjogeleit/http-request-action@v1.16.3
145173
with:
146174
url: ${{ secrets.POWER_AUTOMATE_HOOK_URL }}
147175
method: 'POST'
148176
contentType: 'application/json'
149177
data: |
150178
{
151-
"status": "${{ (needs.drift.result == 'failure' || needs.acceptance.result == 'failure') && 'FAILED' || 'PASSED' }}",
152-
"branch": "main",
153-
"drift_exitcode": "${{ needs.drift.outputs.drifted }}",
154-
"acceptance_outcome": "${{ needs.acceptance.outputs.accepted }}",
155179
"workflow": "${{ github.workflow }}",
180+
"branch": "${{ github.ref_name }}",
156181
"run_id": "${{ github.run_id }}",
157182
"github_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
158-
"tested_versions": ["0.15.5","0.14.11","1.1.2","1.5.3"]
183+
"tested_versions": ["0.15.5","0.14.11","1.1.2","1.5.3"],
184+
"drift_summary": ${{ steps.summarize.outputs.drift_json }},
185+
"acceptance_summary": ${{ steps.summarize.outputs.acc_json }}
159186
}

0 commit comments

Comments
 (0)