Skip to content
Prev Previous commit
another repo edge hase handling
  • Loading branch information
witmicko committed Dec 9, 2025
commit 6d3ad6bdd9fafa1b6fecb4482478abcf4e708dc6
18 changes: 9 additions & 9 deletions .github/workflows/onboard-new-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ jobs:
id: check_empty
run: |
REPO="${{ steps.target.outputs.repository }}"
# Try to get repository info
REPO_INFO=$(gh api "repos/$REPO" 2>/dev/null || echo "")
# Try to list branches in the repository
BRANCHES=$(gh api "repos/$REPO/branches" --jq 'length' 2>/dev/null || echo "0")

if [ -z "$REPO_INFO" ]; then
echo "Failed to get repository info"
exit 1
# If there are no branches, the repo is empty
if [ "$BRANCHES" = "0" ]; then
IS_EMPTY="true"
echo "Repository is empty (no branches found)"
else
IS_EMPTY="false"
echo "Repository has $BRANCHES branch(es)"
fi

# Check if repository has commits (size will be 0 if empty)
IS_EMPTY=$(echo "$REPO_INFO" | jq -r '.size == 0')

echo "is_empty=$IS_EMPTY" >> "$GITHUB_OUTPUT"
echo "Repository empty status: $IS_EMPTY"
shell: bash
env:
GH_TOKEN: ${{ secrets.ONBOARDING_TOKEN }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Opt-out file check documented but never implemented

The PR body template instructs users to add a .github/no-security-scanner file to prevent future onboarding attempts, but the workflow never checks for this file's existence. The onboarding will proceed regardless of whether a team has opted out, making the documented opt-out mechanism non-functional.

Additional Locations (1)

Fix in Cursor Fix in Web

Expand Down
Loading