Support controlled-SWAP's in kernel builder #7880
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
on: | |
workflow_dispatch: | |
inputs: | |
cache_type: | |
type: choice | |
description: What kind of caches to delete. Note that *all* caches of that type will be deleted. | |
options: | |
- branch | |
- tar | |
- selective | |
required: false | |
default: selective | |
cache_keys: | |
type: string | |
description: Space separated string of cache keys to delete. | |
required: false | |
workflow_run: | |
workflows: | |
- CI | |
- Deployments | |
types: | |
- completed | |
delete: | |
pull_request_target: | |
types: | |
- closed | |
name: Clean GitHub caches | |
jobs: | |
automatic_cleanup: | |
name: Clean up GitHub caches produced by other workflows | |
if: github.event_name == 'workflow_run' | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download cache keys | |
id: artifacts | |
run: | | |
artifacts_url=${{ github.event.workflow_run.artifacts_url }} | |
artifacts=$(gh api $artifacts_url -q '.artifacts[] | {name: .name, url: .archive_download_url}') | |
for artifact in `echo "$artifacts"`; do | |
name=`echo $artifact | jq -r '.name'` | |
if [ "${name#cache_key}" != "${name}" ]; then | |
url=`echo $artifact | jq -r '.url'` | |
gh api $url > cache_keys.zip | |
unzip -d cache_keys cache_keys.zip | |
for file in `find cache_keys/ -type f`; do | |
keys+=" `cat $file`" | |
done | |
rm -rf cache_keys cache_keys.zip | |
fi | |
done | |
echo "cache_keys='$(echo $keys)'" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- run: | | |
gh extension install actions/gh-actions-cache | |
for key in `echo ${{ steps.artifacts.outputs.cache_keys }}`; do | |
(gh actions-cache delete $key -R ${{ github.repository }} --confirm && echo "Deleted cache $key") \ | |
|| echo "Cache $key not found" | |
done | |
env: | |
GH_TOKEN: ${{ github.token }} | |
selective_cleanup: | |
name: Clean up selective GitHub caches | |
if: (github.event_name == 'workflow_dispatch' && inputs.cache_keys != '' ) | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- run: | | |
gh extension install actions/gh-actions-cache | |
for key in ${{ inputs.cache_keys }}; do | |
(gh actions-cache delete $key -R ${{ github.repository }} --confirm && echo "Deleted cache $key") \ | |
|| echo "Cache $key not found" | |
done | |
env: | |
GH_TOKEN: ${{ github.token }} | |
tar_cleanup: | |
name: Clean up Github caches with tar archives | |
if: (github.event_name == 'workflow_dispatch' && inputs.cache_type == 'tar' ) | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- run: | | |
gh extension install actions/gh-actions-cache | |
keys=$(gh actions-cache list -R ${{ github.repository }} --key tar- | cut -f 1 ) | |
for key in $keys; do | |
(gh actions-cache delete $key -R ${{ github.repository }} --confirm && echo "Deleted cache $key") \ | |
|| echo "Cache $key not found" | |
done | |
env: | |
GH_TOKEN: ${{ github.token }} | |
branch_cleanup: | |
name: Clean up branch specific GitHub caches | |
if: (github.event_name == 'workflow_dispatch' && inputs.cache_type == 'branch' ) || (github.event_name == 'delete' && github.event.ref_type == 'branch') | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- run: | | |
gh extension install actions/gh-actions-cache | |
keys=$(gh actions-cache list -R ${{ github.repository }} -B ${{ github.event.ref }} | cut -f 1 ) | |
for key in $keys; do | |
(gh actions-cache delete $key -R ${{ github.repository }} --confirm && echo "Deleted cache $key") \ | |
|| echo "Cache $key not found" | |
done | |
env: | |
GH_TOKEN: ${{ github.token }} | |
pr_cleanup: | |
name: Clean up PR related GitHub caches | |
if: github.event_name == 'pull_request_target' | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- run: | | |
gh extension install actions/gh-actions-cache | |
keys=$(gh actions-cache list -R ${{ github.repository }} -B refs/pull/${{ github.event.number }}/merge | cut -f 1 ) | |
for key in $keys; do | |
(gh actions-cache delete $key -R ${{ github.repository }} --confirm && echo "Deleted cache $key") \ | |
|| echo "Cache $key not found" | |
done | |
env: | |
GH_TOKEN: ${{ github.token }} |