Use sccache to cache Windows release builds #1
Workflow file for this run
This file contains hidden or 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
| # Modified from https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy | |
| name: Clean up PR caches | |
| on: | |
| pull_request_target: | |
| types: | |
| - closed | |
| jobs: | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # `actions:write` permission is required to delete caches | |
| # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Clean up caches | |
| run: | | |
| ## Setting this to not fail the workflow while deleting cache keys. | |
| set +e | |
| for i in {1..10} | |
| do | |
| cacheIdsForPR=$(gh cache list -R $REPO -r $BRANCH -L 500 --sort size_in_bytes | cut -f 1 ) | |
| for cacheId in $cacheIdsForPR | |
| do | |
| gh cache delete $cacheId -R $REPO | |
| sleep 0.1 | |
| done | |
| done | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge |