feat(KONFLUX-3903): create pipeline to run tests in konflux #1864
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}\"]" |