Skip to content

Commit

Permalink
Create size-label.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrivedi88 authored Jun 26, 2023
1 parent 0301b8d commit 6a1b832
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/size-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate size
run: |
git fetch --update-shallow
git diff --stat HEAD~1
size=$(cat .git/FETCH_HEAD | wc -l)
- name: Add label
run: |
if [ $size -gt 100 ]; then
echo "Adding size: L"
hub label add ${{ github.head_repo.full_name }} ${{ github.head_ref }} "size: L"
elif [ $size -gt 30 ]; then
echo "Adding size: M"
hub label add ${{ github.head_repo.full_name }} ${{ github.head_ref }} "size: M"
else
echo "Adding size: S"
hub label add ${{ github.head_repo.full_name }} ${{ github.head_ref }} "size: S"
fi

0 comments on commit 6a1b832

Please sign in to comment.