Skip to content

emscripten 4.0.16 -> 5.0.5 (#547) #291

emscripten 4.0.16 -> 5.0.5 (#547)

emscripten 4.0.16 -> 5.0.5 (#547) #291

name: cleanup-caches
on:
push:
paths-ignore:
- '**/README.md'
pull_request:
paths-ignore:
- '**/README.md'
types:
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Setup GitHub CLI
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
run: |
# Ensure the latest version of GitHub CLI is installed
sudo apt-get update && sudo apt-get install -y gh
# Install the actions-cache extension
gh extension install actions/gh-actions-cache || echo "Extension already installed"
- name: Check Token Permissions
run: gh auth status
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
# - name: Cleanup Caches
# run: |
# REPO=${{ github.repository }}
# # Adjust branch reference if necessary
# BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
# echo "Fetching list of cache keys for branch: $BRANCH"
# cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH --json key | jq -r '.[].key')
# if [ -z "$cacheKeysForPR" ]; then
# echo "No caches found for branch: $BRANCH"
# exit 0
# fi
# echo "Deleting caches..."
# for cacheKey in $cacheKeysForPR; do
# echo "Deleting cache: $cacheKey"
# gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
# done
# echo "Cleanup completed."
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Verify Remaining Caches
# run: |
# echo "Checking for remaining caches in branch: $BRANCH"
# remainingCaches=$(gh actions-cache list -R ${{ github.repository }} -B $BRANCH --json key | jq -r '.[].key')
# if [ -z "$remainingCaches" ]; then
# echo "All caches successfully cleared."
# else
# echo "Remaining caches detected:"
# echo "$remainingCaches"
# exit 0
# fi
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}