@@ -71,27 +71,33 @@ def check_dataset_lock(num):
7171 delete_api + str (fileid ), \
7272 auth = (token , "" ))
7373
74- # the following adds all files from the repository to Dataverse
75- path = join ('repo' ,args .dir ) if args .dir else 'repo'
74+ # check if there is a list of dirs to upload
75+ paths = ['repo' ]
76+ if args .dir :
77+ dirs = args .dir .strip ().replace ("," , " " )
78+ dirs = dirs .split ()
79+ paths = [join ('repo' , d ) for d in dirs ]
7680
77- for root , subdirs , files in walk (path ):
78- if '.git' in subdirs :
79- subdirs .remove ('.git' )
80- if '.github' in subdirs :
81- subdirs .remove ('.github' )
82- for f in files :
83- df = Datafile ()
84- df .set ({
85- "pid" : args .doi ,
86- "filename" : f ,
87- "directoryLabel" : root [5 :],
88- "description" : \
89- "Uploaded with GitHub Action from {}." .format (
90- args .repo ),
91- })
92- resp = api .upload_datafile (
93- args .doi , join (root ,f ), df .json ())
94- check_dataset_lock (5 )
81+ # the following adds all files from the repository to Dataverse
82+ for path in paths :
83+ for root , subdirs , files in walk (path ):
84+ if '.git' in subdirs :
85+ subdirs .remove ('.git' )
86+ if '.github' in subdirs :
87+ subdirs .remove ('.github' )
88+ for f in files :
89+ df = Datafile ()
90+ df .set ({
91+ "pid" : args .doi ,
92+ "filename" : f ,
93+ "directoryLabel" : root [5 :],
94+ "description" : \
95+ "Uploaded with GitHub Action from {}." .format (
96+ args .repo ),
97+ })
98+ resp = api .upload_datafile (
99+ args .doi , join (root ,f ), df .json ())
100+ check_dataset_lock (5 )
95101
96102 if args .publish .lower () == 'true' :
97103 # publish updated dataset
0 commit comments