mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-26 18:43:04 +00:00
add cache deletion for closed PRs
This commit is contained in:
parent
c63053adf2
commit
1f49d59e6b
1 changed files with 30 additions and 0 deletions
30
.github/workflows/checks.yml
vendored
30
.github/workflows/checks.yml
vendored
|
@ -11,6 +11,10 @@ on:
|
||||||
- '!*.md'
|
- '!*.md'
|
||||||
- '.github/workflows/*.yml'
|
- '.github/workflows/*.yml'
|
||||||
|
|
||||||
|
pull_request_target:
|
||||||
|
branches: [ master ]
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
checks: write
|
checks: write
|
||||||
|
@ -72,3 +76,29 @@ jobs:
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
needs: format
|
needs: format
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if: github.event.pull_request.merged == false
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup gh extension
|
||||||
|
run: |
|
||||||
|
gh extension install actions/gh-actions-cache
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
run: |
|
||||||
|
echo "Fetching list of cache keys"
|
||||||
|
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
|
||||||
|
|
||||||
|
## Setting this to not fail the workflow while deleting cache keys.
|
||||||
|
set +e
|
||||||
|
echo "Deleting caches..."
|
||||||
|
for cacheKey in $cacheKeysForPR
|
||||||
|
do
|
||||||
|
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
|
||||||
|
done
|
||||||
|
echo "Done"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||||
|
|
Loading…
Reference in a new issue