forked from Echo-Mirror-Butler/echomirror-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (34 loc) · 1.18 KB
/
Copy pathpr_guard.yml
File metadata and controls
38 lines (34 loc) · 1.18 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: PR Guard
on:
pull_request:
branches: [main]
jobs:
size-check:
runs-on: ubuntu-latest
steps:
- name: Check PR size
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const additions = pr.additions;
const deletions = pr.deletions;
const total = additions + deletions;
const labels = pr.labels.map(l => l.name);
if (labels.includes('large-pr-approved')) {
core.info(`PR size check skipped — "large-pr-approved" label is present (${total} lines).`);
return;
}
if (total > 600) {
core.warning(
`This PR changes ${total} lines (+${additions}/-${deletions}). ` +
"Consider splitting it into smaller PRs for easier review."
);
}
if (total > 3000) {
core.setFailed(
`PR is too large (${total} lines changed). ` +
"Please split into smaller focused PRs. " +
'Add the "large-pr-approved" label to bypass this check.'
);
}