Feature/SK-1257 | Bugfixes and improvements of combiner, and new load test #431
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: "PR Size Labeler" | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get PR Size | |
id: get_pr_size | |
run: | | |
CHANGED_FILES=$(jq '.pull_request.changed_files' $GITHUB_EVENT_PATH) | |
ADDITIONS=$(jq '.pull_request.additions' $GITHUB_EVENT_PATH) | |
DELETIONS=$(jq '.pull_request.deletions' $GITHUB_EVENT_PATH) | |
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV | |
echo "ADDITIONS=$ADDITIONS" >> $GITHUB_ENV | |
echo "DELETIONS=$DELETIONS" >> $GITHUB_ENV | |
# OBS that we are cuurently not on a stable version, thus major is disabled for now | |
- name: Apply Labels Based on Size | |
if: ${{ github.event.pull_request.changed_files != '' }} | |
run: | | |
PATCH_THRESHOLD=10 | |
MINOR_THRESHOLD=500 | |
MAJOR_THRESHOLD=1000 | |
TOTAL_CHANGES=$(($ADDITIONS + $DELETIONS)) | |
echo "Total changes: $TOTAL_CHANGES" | |
if [ "$TOTAL_CHANGES" -le "$PATCH_THRESHOLD" ]; then | |
LABEL="patch" | |
elif [ "$TOTAL_CHANGES" -le "$MINOR_THRESHOLD" ]; then | |
LABEL="minor" | |
else | |
LABEL="minor" | |
fi | |
echo "Applying label: $LABEL" | |
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \ | |
-d "{\"labels\":[\"$LABEL\"]}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ADDITIONS: ${{ env.ADDITIONS }} | |
DELETIONS: ${{ env.DELETIONS }} |