generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.46 KB
/
check_pr.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
47
48
49
50
51
52
53
54
55
56
name: Check PR
# Controls when the workflow will run
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
permissions:
pull-requests: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
labeler:
name: Add label to PR based on the paths of files being changed
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # pin@v4
check_pr_size:
name: Check PR size doesn't break set limit
runs-on: ubuntu-latest
steps:
# checkout your code with your git history
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
with:
fetch-depth: 0
- name: Get total lines changed
run: |
size=$(git diff --stat origin/develop --diff-filter=d \
| grep -v .lock \
| awk -F"|" '{ print $2 }' \
| awk '{ print $1 }' \
| sed '/^$/d' \
| paste -sd+ - \
| bc)
echo "size=${size}" >> $GITHUB_ENV
echo ""
echo "Total lines changed (note: *.lock files are excluded from this count): "
echo $size
shell: bash
- run: |
if [[ $size -gt 500 ]]
then
echo "Warning - total lines changed is greater than 500."
echo "Please consider breaking this PR down."
exit 1
fi
shell: bash