File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -57,19 +57,19 @@ jobs:
5757 id : check_empty
5858 run : |
5959 REPO="${{ steps.target.outputs.repository }}"
60- # Try to get repository info
61- REPO_INFO =$(gh api "repos/$REPO" 2>/dev/null || echo "")
60+ # Try to list branches in the repository
61+ BRANCHES =$(gh api "repos/$REPO/branches" --jq 'length' 2>/dev/null || echo "0 ")
6262
63- if [ -z "$REPO_INFO" ]; then
64- echo "Failed to get repository info"
65- exit 1
63+ # If there are no branches, the repo is empty
64+ if [ "$BRANCHES" = "0" ]; then
65+ IS_EMPTY="true"
66+ echo "Repository is empty (no branches found)"
67+ else
68+ IS_EMPTY="false"
69+ echo "Repository has $BRANCHES branch(es)"
6670 fi
6771
68- # Check if repository has commits (size will be 0 if empty)
69- IS_EMPTY=$(echo "$REPO_INFO" | jq -r '.size == 0')
70-
7172 echo "is_empty=$IS_EMPTY" >> "$GITHUB_OUTPUT"
72- echo "Repository empty status: $IS_EMPTY"
7373 shell : bash
7474 env :
7575 GH_TOKEN : ${{ secrets.ONBOARDING_TOKEN }}
You can’t perform that action at this time.
0 commit comments