Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Rename the github app name #381

Rename the github app name

Rename the github app name #381

Workflow file for this run

name: Size label
on: pull_request_target
jobs:
size-label:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Install jq
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Size label
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate size
run: |
additions=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq '.additions')
deletions=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq '.deletions')
size=$((additions + deletions))
echo "SIZE=$size" >> $GITHUB_ENV
- name: Add label
run: |
if [ ${{ env.SIZE }} -gt 100 ]; then
echo "Adding size: XXL"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: XXL"]'
elif [ ${{ env.SIZE }} -gt 50 ]; then
echo "Adding size: XL"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: XL"]'
elif [ ${{ env.SIZE }} -gt 30 ]; then
echo "Adding size: L"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: L"]'
elif [ ${{ env.SIZE }} -gt 15 ]; then
echo "Adding size: M"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: M"]'
elif [ ${{ env.SIZE }} -gt 5 ]; then
echo "Adding size: S"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: S"]'
else
echo "Adding size: XS"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: XS"]'
fi