This repository was archived by the owner on Nov 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 77 pull-requests : write
88 runs-on : ubuntu-latest
99 steps :
10+ - name : Install jq
11+ run : |
12+ sudo apt-get update
13+ sudo apt-get install -y jq
1014 - name : Size label
1115 uses : actions/checkout@v3
1216 with :
1317 token : ${{ secrets.GITHUB_TOKEN }}
14- - name : Install hub
15- run : |
16- sudo apt-get update
17- sudo apt-get install -y hub
1818 - name : Calculate size
1919 run : |
20- if git rev-parse HEAD~1 >/dev/null 2>&1; then
21- git fetch origin main --update-shallow
22- git diff --stat HEAD~1
23- size=$(cat .git/FETCH_HEAD | wc -l)
24- else
25- echo "No previous commits"
26- size=0
27- fi
20+ additions=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq '.additions')
21+ deletions=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq '.deletions')
22+ size=$((additions + deletions))
2823 echo "SIZE=$size" >> $GITHUB_ENV
2924 - name : Add label
3025 run : |
6560 https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
6661 -d '["size: XS"]'
6762 fi
63+
You can’t perform that action at this time.
0 commit comments