11
11
12
12
def arg_parse ():
13
13
""" simple argparser """
14
- parser = argparse .ArgumentParser (description = 'github_actions_clean .py - clean github action logs and artifacts' )
14
+ parser = argparse .ArgumentParser (description = 'gh_workflow_runs_delete .py - delete github action logs and artifacts' )
15
15
parser .add_argument ('-d' , '--debug' , help = 'debug mode' , action = "store_true" , default = False )
16
16
parser .add_argument ('-r' , '--reponame' , help = 'repositoryname' , default = None )
17
17
parser .add_argument ('-u' , '--username' , help = 'username' , default = None )
@@ -50,9 +50,9 @@ def branchlist_get(debug, auth, reponame):
50
50
51
51
return branch_list
52
52
53
- def actionslist_get (debug , auth , reponame ):
53
+ def wfruns_get (debug , auth , reponame ):
54
54
""" get list of runs """
55
- print_debug (debug , 'actionslist_get ()' )
55
+ print_debug (debug , 'wfruns_get ()' )
56
56
perpage = 100
57
57
url = 'https://api.github.com/repos/{0}/actions/runs?per_page={1}' .format (reponame , perpage )
58
58
resp = requests .get (url = url , auth = auth )
@@ -74,9 +74,9 @@ def actionslist_get(debug, auth, reponame):
74
74
# json_store('ids.json', workflow_list)
75
75
return workflow_list
76
76
77
- def actionlist_group (debug , action_list ):
77
+ def wfruns_group (debug , action_list ):
78
78
""" group action list by branch """
79
- print_debug (debug , 'actionlist_group ()' )
79
+ print_debug (debug , 'wfruns_group ()' )
80
80
actions_dic = {}
81
81
for workflow in action_list :
82
82
if 'head_branch' in workflow and 'head_sha' in workflow and 'head_commit' in workflow and 'id' in workflow :
@@ -145,11 +145,11 @@ def idlist_delete(debug, auth, reponame, id_list):
145
145
BRANCH_LIST = branchlist_get (DEBUG , AUTH , REPONAME )
146
146
# print(BRANCH_LIST)
147
147
if BRANCH_LIST :
148
- ACTION_LIST = actionslist_get (DEBUG , AUTH , REPONAME )
148
+ ACTION_LIST = wfruns_get (DEBUG , AUTH , REPONAME )
149
149
# ACTION_LIST = json_load('foo.json')
150
150
151
151
# group actions per branch
152
- ACTION_DIC = actionlist_group (DEBUG , ACTION_LIST )
152
+ ACTION_DIC = wfruns_group (DEBUG , ACTION_LIST )
153
153
154
154
# select ids to be deleted
155
155
ID_LIST = idlist_filter (DEBUG , ACTION_DIC , BRANCH_LIST , COMMIT_NUMBER )
0 commit comments