Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 445668b

Browse files
authored
Update size-label.yml
1 parent 2af19f4 commit 445668b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/size-label.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ jobs:
1313
token: ${{ secrets.GITHUB_TOKEN }}
1414
- name: Calculate size
1515
run: |
16-
git fetch
17-
git fetch --update-shallow
18-
git diff --stat HEAD~1
19-
size=$(cat .git/FETCH_HEAD | wc -l)
16+
if git rev-parse HEAD~1 >/dev/null 2>&1; then
17+
git fetch origin main --update-shallow
18+
git diff --stat HEAD~1
19+
size=$(cat .git/FETCH_HEAD | wc -l)
20+
else
21+
echo "No previous comments"
22+
size=0
23+
fi
2024
- name: Add label
2125
run: |
2226
if [ $size -gt 100 ]; then
@@ -28,5 +32,4 @@ jobs:
2832
else
2933
echo "Adding size: S"
3034
hub label add ${{ github.head_repo.full_name }} ${{ github.head_ref }} "size: S"
31-
fi
32-
35+
fi

0 commit comments

Comments
 (0)