@@ -75,23 +75,87 @@ jobs:
7575 ARGS="$ARGS --enable-deletion"
7676 fi
7777
78- # Run the Python script with uv
78+ # Run the Python script with uv and capture output
7979 echo "🚀 Running S3 results tagger with args: $ARGS"
80- uv run .github/s3_results_tagger.py $ARGS
80+ uv run .github/s3_results_tagger.py $ARGS | tee s3_tagging_output.log
8181
8282 - name : Post job summary
8383 if : always()
8484 run : |
85- echo "## S3 Results Tagging Summary" >> $GITHUB_STEP_SUMMARY
86- echo "- **Trigger**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
87- echo "- **Bucket**: ${{ env.S3_BUCKET }}" >> $GITHUB_STEP_SUMMARY
85+ echo "# 🏷️ S3 Results Tagging Summary" >> $GITHUB_STEP_SUMMARY
86+ echo "" >> $GITHUB_STEP_SUMMARY
87+
88+ # Basic information
89+ echo "## 📋 Job Information" >> $GITHUB_STEP_SUMMARY
90+ echo "| Setting | Value |" >> $GITHUB_STEP_SUMMARY
91+ echo "|---------|-------|" >> $GITHUB_STEP_SUMMARY
92+ echo "| **Trigger** | ${{ github.event_name }} |" >> $GITHUB_STEP_SUMMARY
93+ echo "| **Bucket** | \`${{ env.S3_BUCKET }}\` |" >> $GITHUB_STEP_SUMMARY
8894 if [ "${{ github.event_name }}" = "pull_request" ]; then
89- echo "- **Mode**: DRY RUN (forced for PR safety)" >> $GITHUB_STEP_SUMMARY
90- echo "- **Deletion enabled**: false (disabled for PRs) " >> $GITHUB_STEP_SUMMARY
95+ echo "| **Mode** | 🔒 DRY RUN (forced for PR safety) | " >> $GITHUB_STEP_SUMMARY
96+ echo "| **Deletion enabled** | ❌ Disabled for PRs | " >> $GITHUB_STEP_SUMMARY
9197 else
92- echo "- **Mode**: ${{ github.event.inputs.dry_run == 'false' && 'LIVE' || 'DRY RUN' }}" >> $GITHUB_STEP_SUMMARY
93- echo "- **Deletion enabled**: ${{ github.event.inputs.enable_deletion || 'false' }}" >> $GITHUB_STEP_SUMMARY
98+ MODE="${{ github.event.inputs.dry_run == 'false' && '🔴 LIVE' || '🟡 DRY RUN' }}"
99+ DELETION="${{ github.event.inputs.enable_deletion == 'true' && '⚠️ Enabled' || '✅ Disabled' }}"
100+ echo "| **Mode** | $MODE |" >> $GITHUB_STEP_SUMMARY
101+ echo "| **Deletion enabled** | $DELETION |" >> $GITHUB_STEP_SUMMARY
94102 fi
95- echo "- **Timestamp**: $(date -u)" >> $GITHUB_STEP_SUMMARY
103+ echo "| **Timestamp** | $(date -u) | " >> $GITHUB_STEP_SUMMARY
96104 echo "" >> $GITHUB_STEP_SUMMARY
97- echo "Check the workflow logs for detailed information about tagged directories." >> $GITHUB_STEP_SUMMARY
105+
106+ # Parse the output log for statistics and orphaned directories
107+ if [ -f "s3_tagging_output.log" ]; then
108+ echo "## 📊 Statistics" >> $GITHUB_STEP_SUMMARY
109+
110+ # Extract statistics (matching the actual log format with timestamps and log levels)
111+ CURRENT_TAGGED=$(grep "Current releases tagged:" s3_tagging_output.log | grep -o "[0-9]*$" || echo "0")
112+ ORPHANED_TAGGED=$(grep "Orphaned directories tagged:" s3_tagging_output.log | grep -o "[0-9]*$" || echo "0")
113+ ORPHANED_DELETED=$(grep "Orphaned directories deleted:" s3_tagging_output.log | grep -o "[0-9]*$" || echo "0")
114+ ERRORS=$(grep "Errors encountered:" s3_tagging_output.log | grep -o "[0-9]*$" || echo "0")
115+
116+ echo "- ✅ **Current releases tagged**: $CURRENT_TAGGED" >> $GITHUB_STEP_SUMMARY
117+ echo "- 🗑️ **Orphaned directories tagged**: $ORPHANED_TAGGED" >> $GITHUB_STEP_SUMMARY
118+ if [ "$ORPHANED_DELETED" != "0" ]; then
119+ echo "- 🗑️ **Orphaned directories deleted**: $ORPHANED_DELETED" >> $GITHUB_STEP_SUMMARY
120+ fi
121+ echo "- ❌ **Errors encountered**: $ERRORS" >> $GITHUB_STEP_SUMMARY
122+ echo "" >> $GITHUB_STEP_SUMMARY
123+
124+ # Extract orphaned directories if any
125+ if [ "$ORPHANED_TAGGED" != "0" ]; then
126+ echo "## 🗑️ Orphaned Directories Found" >> $GITHUB_STEP_SUMMARY
127+ echo "" >> $GITHUB_STEP_SUMMARY
128+ echo "The following directories were tagged as orphaned (no longer matching current pipeline releases):" >> $GITHUB_STEP_SUMMARY
129+ echo "" >> $GITHUB_STEP_SUMMARY
130+
131+ # Extract orphaned directory lines and format for GitHub
132+ grep "Tagged orphaned directory:" s3_tagging_output.log | sed 's/.*Tagged orphaned directory: /- `/' | sed 's/$/`/' >> $GITHUB_STEP_SUMMARY || true
133+
134+ echo "" >> $GITHUB_STEP_SUMMARY
135+ if [ "${{ github.event.inputs.enable_deletion || 'false' }}" = "false" ]; then
136+ echo "💡 **Note**: Deletion is disabled. These directories are only tagged with \`deleteme=true\` for future cleanup." >> $GITHUB_STEP_SUMMARY
137+ else
138+ echo "⚠️ **Warning**: Deletion is enabled. These directories will be permanently removed." >> $GITHUB_STEP_SUMMARY
139+ fi
140+ echo "" >> $GITHUB_STEP_SUMMARY
141+
142+ # Extract pipeline breakdown if available
143+ if grep -q "ORPHANED DIRECTORIES BY PIPELINE:" s3_tagging_output.log; then
144+ echo "### 📋 Breakdown by Pipeline" >> $GITHUB_STEP_SUMMARY
145+ echo "" >> $GITHUB_STEP_SUMMARY
146+ # Extract pipeline counts
147+ sed -n '/ORPHANED DIRECTORIES BY PIPELINE:/,/====/p' s3_tagging_output.log | grep "orphaned directories" | sed 's/.*• /- **/' | sed 's/: / directories**: /' >> $GITHUB_STEP_SUMMARY || true
148+ echo "" >> $GITHUB_STEP_SUMMARY
149+ fi
150+ else
151+ echo "## ✨ All Clear!" >> $GITHUB_STEP_SUMMARY
152+ echo "" >> $GITHUB_STEP_SUMMARY
153+ echo "No orphaned directories found - all results directories match current pipeline releases." >> $GITHUB_STEP_SUMMARY
154+ echo "" >> $GITHUB_STEP_SUMMARY
155+ fi
156+ else
157+ echo "⚠️ **Warning**: Could not find output log file. Check the workflow logs for detailed information." >> $GITHUB_STEP_SUMMARY
158+ fi
159+
160+ echo "---" >> $GITHUB_STEP_SUMMARY
161+ echo "📋 **Full details**: Check the [workflow logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for complete output." >> $GITHUB_STEP_SUMMARY
0 commit comments