@@ -33,6 +33,18 @@ outputs:
3333 kept_runs :
3434 description : ' Number of workflow runs kept'
3535 value : ${{ steps.cleanup.outputs.kept_runs }}
36+ failed_deletions :
37+ description : ' Number of failed deletions (if any)'
38+ value : ${{ steps.cleanup.outputs.failed_deletions }}
39+ cutoff_date :
40+ description : ' The cutoff date used for deletion (ISO format)'
41+ value : ${{ steps.cleanup.outputs.cutoff_date }}
42+ dry_run :
43+ description : ' Whether this was a dry run (true/false)'
44+ value : ${{ steps.cleanup.outputs.dry_run }}
45+ summary :
46+ description : ' Brief summary of the cleanup operation'
47+ value : ${{ steps.cleanup.outputs.summary }}
3648
3749runs :
3850 using : ' composite'
@@ -144,6 +156,10 @@ runs:
144156 echo "total_runs=${total_runs}" >> $GITHUB_OUTPUT
145157 echo "deleted_runs=0" >> $GITHUB_OUTPUT
146158 echo "kept_runs=${runs_to_keep}" >> $GITHUB_OUTPUT
159+ echo "failed_deletions=0" >> $GITHUB_OUTPUT
160+ echo "cutoff_date=${CUTOFF_DATE}" >> $GITHUB_OUTPUT
161+ echo "dry_run=${DRY_RUN}" >> $GITHUB_OUTPUT
162+ echo "summary=No cleanup needed: Found ${total_runs} runs, all ${runs_to_keep} kept" >> $GITHUB_OUTPUT
147163 exit 0
148164 fi
149165
@@ -177,17 +193,27 @@ runs:
177193 # Cleanup temp files
178194 rm -f "$ALL_RUNS" "${ALL_RUNS}.sorted" "$RUNS_TO_DELETE"
179195
196+ # Set common outputs
197+ echo "total_runs=${total_runs}" >> $GITHUB_OUTPUT
198+ echo "kept_runs=${runs_to_keep}" >> $GITHUB_OUTPUT
199+ echo "cutoff_date=${CUTOFF_DATE}" >> $GITHUB_OUTPUT
200+ echo "dry_run=${DRY_RUN}" >> $GITHUB_OUTPUT
201+
180202 if [[ "$DRY_RUN" == "true" ]]; then
181203 echo "✅ Dry run completed! Would have deleted ${runs_to_delete} runs."
182- echo "total_runs=${total_runs}" >> $GITHUB_OUTPUT
183204 echo "deleted_runs=0" >> $GITHUB_OUTPUT
184- echo "kept_runs=${runs_to_keep}" >> $GITHUB_OUTPUT
205+ echo "failed_deletions=0" >> $GITHUB_OUTPUT
206+ echo "summary=Dry run: Found ${total_runs} runs, would delete ${runs_to_delete}, keeping ${runs_to_keep}" >> $GITHUB_OUTPUT
185207 else
186208 echo "✅ Cleanup completed!"
187209 echo " - Successfully deleted: ${deleted_count} runs"
188210 echo " - Failed to delete: ${failed_count} runs"
189- echo "total_runs=${total_runs}" >> $GITHUB_OUTPUT
190211 echo "deleted_runs=${deleted_count}" >> $GITHUB_OUTPUT
191- echo "kept_runs=${runs_to_keep}" >> $GITHUB_OUTPUT
212+ echo "failed_deletions=${failed_count}" >> $GITHUB_OUTPUT
213+ if [[ "$failed_count" -gt 0 ]]; then
214+ echo "summary=Cleanup completed: ${deleted_count} deleted, ${runs_to_keep} kept, ${failed_count} failed" >> $GITHUB_OUTPUT
215+ else
216+ echo "summary=Cleanup completed: ${deleted_count} deleted, ${runs_to_keep} kept" >> $GITHUB_OUTPUT
217+ fi
192218 fi
193219
0 commit comments