generated from frehburg/TemplateForPythonProjects
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.47 KB
/
locs.yml
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
39
40
41
42
43
44
45
46
name: Count LOC in Python Files
on:
push:
branches: [ develop ]
pull_request:
branches: [ main, develop ]
jobs:
count-loc:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Count Total Lines of Code in Python Files
id: loc # Give this step an ID to reference later
run: |
echo "Counting total lines of Python code..."
LOC_COUNT=$(git ls-files '*.py' | xargs wc -l | tail -n 1)
echo "LOC_COUNT=${LOC_COUNT}" >> $GITHUB_ENV
echo "Python Lines of Code (LOC): $LOC_COUNT"
- name: Post LOC Count as PR Comment (Only for Main Branch)
if: github.event_name == 'pull_request' && github.base_ref == 'main'
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### Python Lines of Code (LOC) Summary
Total lines of Python code in this repository:
```
${{ env.LOC_COUNT }}
```
- name: Create Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 25d4f4d4d222fcb5f266a280b1dd60d4
filename: phenopacket_mapper_locs.JSON # Use test.svg if you want to use the SVG mode.
label: Lines of Code
message: ${{ env.LOC_COUNT }}
color: blue