-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0301b8d
commit 6a1b832
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
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
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 | ||