GraphQL: Report multiple query errors #52
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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,sizeInBytes,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 |" >> $GITHUB_STEP_SUMMARY | |
echo "|----------|-----------|------|" >> $GITHUB_STEP_SUMMARY | |
# Extract IDs and process deletions | |
echo "$CACHE_LIST" | jq -r '.[] | [.id, .key, .sizeInBytes] | @tsv' | while IFS=$'\t' read -r id key size; 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" | |
gh cache delete $id | |
echo "[INFO] Processed cache $id" | |
# Add row to summary table | |
echo "| \`$id\` | \`$key\` | $readable_size |" >> $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 |