-
Notifications
You must be signed in to change notification settings - Fork 12
38 lines (38 loc) · 1.23 KB
/
Copy pathanalyze.yml
File metadata and controls
38 lines (38 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: analyze-source-code
run-name: breakdown of files by type for ${{ github.actor }}
on: [push]
jobs:
count-file-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: report-results
run: |
import os
import csv
if __name__ == '__main__':
ftc = {}
for root, dirs, files in os.walk("."):
for name in files:
np = name.split('.')
ft = np[-1]
if len(ft) <= 5:
if ft in ftc:
ftc[ft] = ftc[ft] + 1
else:
ftc[ft] = 1
with open('count-file-types.csv', 'w', newline='') as csvfile:
fn = ['type', 'count']
report = csv.DictWriter(csvfile, fieldnames=fn)
report.writeheader()
for k, v in ftc.items():
row = {}
row['type'] = k
row['count'] = v
report.writerow(row)
shell: python
- uses: actions/upload-artifact@v4
with:
name: count-files-type-report
path: count-file-types.csv
overwrite: true