Skip to content

Remove loading psych gem early to fix cucumber spec #38

Remove loading psych gem early to fix cucumber spec

Remove loading psych gem early to fix cucumber spec #38

Workflow file for this run

# Reference:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
name: Cleanup caches by a branch
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
echo "# Cache Cleanup Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**PR Number:** #${{ github.event.pull_request.number }}" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** \`$BRANCH\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[DEBUG] Fetching cache list..."
# Get full cache details
CACHE_LIST=$(gh cache list --ref $BRANCH --limit 100 --json key,size,createdAt,id)
if [ -z "$CACHE_LIST" ] || [ "$CACHE_LIST" = "[]" ]; then
echo "[DEBUG] No caches found"
echo "No caches found for this PR" >> $GITHUB_STEP_SUMMARY
exit 0
fi
# Create table header
echo "| Cache ID | Cache Key | Size | Created At | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-----------|------|------------|--------|" >> $GITHUB_STEP_SUMMARY
# Extract IDs and process deletions
echo "$CACHE_LIST" | jq -r '.[] | [.id, .key, .size, .createdAt] | @tsv' | while IFS=$'\t' read -r id key size created; do
# Convert size to human readable format
if [ $size -ge 1048576 ]; then
readable_size=$(echo "scale=2; $size/1048576" | bc)"MB"
else
readable_size=$(echo "scale=2; $size/1024" | bc)"KB"
fi
echo "[DELETE] Processing cache ID: $id"
if gh cache delete $id > /dev/null 2>&1; then
status="✅ Deleted"
echo "[SUCCESS] Cache $id deleted"
else
status="❌ Failed"
echo "[ERROR] Failed to delete cache $id"
fi
# Add row to summary table
echo "| \`$id\` | \`$key\` | $readable_size | $created | $status |" >> $GITHUB_STEP_SUMMARY
done
# Add completion timestamp
echo "" >> $GITHUB_STEP_SUMMARY
echo "Cleanup completed at: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge