Skip to content

nightly orphaned runners cleanup #728

nightly orphaned runners cleanup

nightly orphaned runners cleanup #728

Workflow file for this run

name: 'nightly orphaned runners cleanup'
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *' # every night at 1 am UTC
jobs:
remove-runners:
runs-on: ubuntu-latest
steps:
- name: removing orphaned self-runners
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
gh api -H "Accept: application/vnd.github.v3+json" /repos/orb-community/pktvisor/actions/runners -q '.runners[] | {id,status,busy} | select((.busy == false) and (.status == "offline")) | {id} | .[]' --paginate | xargs -I {} gh api --method DELETE -H "Accept: application/vnd.github.v3+json" /repos/orb-community/pktvisor/actions/runners/{}
# - name: Clear cache
# uses: actions/github-script@v6
# with:
# script: |
# console.log("About to clear")
# const caches = await github.rest.actions.getActionsCacheList({
# owner: context.repo.owner,
# repo: context.repo.repo,
# })
# for (const cache of caches.data.actions_caches) {
# console.log(cache)
# github.rest.actions.deleteActionsCacheById({
# owner: context.repo.owner,
# repo: context.repo.repo,
# cache_id: cache.id,
# })
# }
# console.log("Clear completed")