Skip to content

feat(STONEINTG-966): ensure override snapshot is valid to be released #1616

feat(STONEINTG-966): ensure override snapshot is valid to be released

feat(STONEINTG-966): ensure override snapshot is valid to be released #1616

Workflow file for this run

name: Pull request size
on: pull_request_target
jobs:
size-label:
name: Size label
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Calculate size
run: |
#!/usr/bin/bash
set -euo pipefail
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))
sizelabel=XS
if [ ${size} -gt 600 ]; then
sizelabel="XXL"
elif [ ${size} -gt 240 ]; then
sizelabel="XL"
elif [ ${size} -gt 120 ]; then
sizelabel="L"
elif [ ${size} -gt 60 ]; then
sizelabel="M"
elif [ ${size} -gt 35 ]; then
sizelabel="S"
fi
echo "Adding size: ${sizelabel}"
curl -s --fail-with-body -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: ${sizelabel}\"]"