Files
RSSHub/.github/workflows/cleanup-pr-cache.yml
2026-10-10 10:03:01 +08:00

35 lines
1.2 KiB
YAML

name: Clean up PR cache
on:
pull_request_target:
types:
- closed
workflow_dispatch:
inputs:
pr_number:
description: 'Pull request number'
required: true
type: number
jobs:
cleanup:
runs-on: ubuntu-slim
timeout-minutes: 5
permissions:
actions: write
steps:
- name: Delete caches of the PR
run: gh cache delete --all --repo "$REPO" --ref "$REF" --succeed-on-no-caches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
REF: refs/pull/${{ github.event.pull_request.number || inputs.pr_number }}/merge
- name: Delete caches of the PR branch
if: github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == github.repository
run: gh cache delete --all --repo "$REPO" --ref "$REF" --succeed-on-no-caches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
REF: refs/heads/${{ github.event.pull_request.head.ref }}