Skip to content

Commit 2dbc344

Browse files
authored
added current year to header (#5)
1 parent c9a7379 commit 2dbc344

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/script.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import os
2+
import datetime
23

34
header_test = 'Released under a MIT (SEI)-style license'
4-
header = 'Copyright 2021 Carnegie Mellon University. All Rights Reserved. \n Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information.'
5+
header = 'Copyright ' + str(datetime.date.today().year) + ' Carnegie Mellon University. All Rights Reserved. \n Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information.'
56

67
print('header not in:')
7-
# iterate over all files in directory
8+
# iterate over all files in directory
89
for root, dirs, files in os.walk("."):
910
for file in files:
1011
# only care about files with extensions considered to be source code
@@ -17,10 +18,10 @@
1718
# add header to file
1819
if file.endswith(('.cs', '.ts', '.js', '.css', '.go', '.scss', '.php')):
1920
# comment type ' /* __ */
20-
with open(os.path.join(root,file), 'w') as modified: modified.write('/*\n' + header + '\n*/\n\n' + data)
21+
with open(os.path.join(root,file), 'w') as modified: modified.write('/*\n ' + header + '\n*/\n\n' + data)
2122
elif file.endswith(('.xml', '.html')):
2223
# comment type ' <!-- __ --> '
23-
with open(os.path.join(root,file), 'w') as modified: modified.write('<!--\n' + header + '\n-->\n\n' + data)
24+
with open(os.path.join(root,file), 'w') as modified: modified.write('<!--\n ' + header + '\n-->\n\n' + data)
2425
elif file.endswith('py'):
2526
# comment type ' """ ___ """ '
26-
with open(os.path.join(root,file), 'w') as modified: modified.write('"""\n' + header + '\n"""\n\n' + data)
27+
with open(os.path.join(root,file), 'w') as modified: modified.write('"""\n ' + header + '\n"""\n\n' + data)

0 commit comments

Comments
 (0)