Skip to content

Update proc_creating_custom_test.adoc #47

Update proc_creating_custom_test.adoc

Update proc_creating_custom_test.adoc #47

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: Size label
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install hub
run: |
sudo apt-get update
sudo apt-get install -y hub
- name: Calculate size
run: |
if git rev-parse HEAD~1 >/dev/null 2>&1; then
git fetch origin main --update-shallow
git diff --stat HEAD~1
size=$(cat .git/FETCH_HEAD | wc -l)
else
echo "No previous commits"
size=0
fi
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://github.com/gitapi/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://github.com/gitapi/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://github.com/gitapi/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://github.com/gitapi/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://github.com/gitapi/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://github.com/gitapi/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '["size: XS"]'
fi