-
Notifications
You must be signed in to change notification settings - Fork 37
103 lines (86 loc) · 2.78 KB
/
ci_loc_pr.yaml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: PR Lines of Code
on:
pull_request:
branches: ["**"]
jobs:
detailed-loc-pr:
name: Detailed Lines of Code Count for PR
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install Rust
uses: dtolnay/[email protected]
with:
components: rustfmt, clippy
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Run Lines of Code Counter for PR
run: make loc-detailed
- name: Upload PR Detailed Lines of Code Count Data
uses: actions/upload-artifact@v4
with:
name: pr-loc-data
path: current_detailed_loc_report.json
detailed-loc-main:
name: Detailed Lines of Code Count for main
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
- name: Install Rust
uses: dtolnay/[email protected]
with:
components: rustfmt, clippy
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
- name: Run Lines of Code Counter for main
run: |
make loc-detailed
mv current_detailed_loc_report.json previous_detailed_loc_report.json
- name: Upload main Detailed Lines of Code Count Data
uses: actions/upload-artifact@v4
with:
name: main-loc-data
path: previous_detailed_loc_report.json
detailed-loc-comparison:
name: Compare Detailed Lines of Code Count
runs-on: ubuntu-latest
needs: [detailed-loc-pr, detailed-loc-main]
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Download PR Detailed Lines of Code Count Data
uses: actions/download-artifact@v4
with:
name: pr-loc-data
path: .
- name: Download main Detailed Lines of Code Count Data
uses: actions/download-artifact@v4
with:
name: main-loc-data
path: .
- name: Compare Detailed Lines of Code Count
run: make loc-compare-detailed
- name: Find comment
continue-on-error: true
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "Total lines changed"
- name: Create Comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-path: detailed_loc_report.txt
edit-mode: replace