Skip to content

Commit c8946fe

Browse files
Post JSON summary to report processor (#1719)
* feat: post workflow json to endpoint * fix: ensure post includes run_id * fix: improve how json payload is created * fix: use github bearer token instead of api key * fix: skip curl if there is an earlier failure --------- Co-authored-by: Jessica Way <[email protected]>
1 parent ee8f7ce commit c8946fe

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/warp_test_workflow.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,33 @@ jobs:
471471
name: workflow-summary
472472
path: workflow_summary.json
473473

474-
# Step 14: Print Summary on Success
474+
# Step 14: Post Summary Artifact
475+
# Purpose: Sends the workflow summary JSON to the workflow analysis processor
476+
- name: Post Summary Artifact
477+
if: always()
478+
env:
479+
WORKFLOW_RUN_ID: ${{ github.run_id }}
480+
run: |
481+
if [ -f "workflow_summary.json" ]; then
482+
jq -n --arg RUN_ID "$WORKFLOW_RUN_ID" --slurpfile SUMMARY workflow_summary.json '{run_id: $RUN_ID, summary: $SUMMARY[0].summary}' > workflow_payload.json
483+
curl -X POST "https://workflow-processor-5zhxczqoxq-uc.a.run.app/api/workflow-summary/" \
484+
-H "Content-Type: application/json" \
485+
-H "Authorization: Bearer ${{ github.token }}" \
486+
-d @workflow_payload.json
487+
else
488+
echo "Warning: workflow_summary.json not found. Check for earlier failures."
489+
fi
490+
491+
# Step 15: Print Summary on Success
475492
# Purpose: Prints the final summary of the pipeline execution in case of success
476493
- name: Print Summary on Success
477494
if: success()
478495
run: |
479496
echo "# :white_check_mark: Pipeline Execution Summary :white_check_mark:" >> $GITHUB_STEP_SUMMARY
480497
481-
# Step 15: Print Summary on Failure
498+
# Step 16: Print Summary on Failure
482499
# Purpose: Prints the final summary of the pipeline execution in case of failure
483500
- name: Print Summary on Failure
484501
if: failure()
485502
run: |
486-
echo "# :x: Pipeline Execution Summary (on Failure) :x: " >> $GITHUB_STEP_SUMMARY
503+
echo "# :x: Pipeline Execution Summary (on Failure) :x: " >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)