modernize

This commit is contained in:
Axel Kohlmeyer
2023-10-27 00:20:05 -04:00
parent 717e1d4319
commit b9283cfcf6
5 changed files with 34 additions and 19 deletions

24
purge-workflows.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
from yaml import load
import subprocess
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True)
data = load(runs,Loader=Loader)
while data['total_count'] > 3:
print('remaining: ', data['total_count'])
num=1
for d in data['workflow_runs']:
print(num, d['id'],d['name'],d['run_number'])
num += 1
if num > 4:
subprocess.call('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']), shell=True)
#print('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']))
else:
print('skip')
runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True)
data = load(runs,Loader=Loader)