We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 27e6a83 commit ecc9d0aCopy full SHA for ecc9d0a
.github/workflows/onboard-new-repo.yml
@@ -39,7 +39,13 @@ jobs:
39
40
# Auto-detect default branch from the repository
41
echo "Detecting default branch for $REPO..."
42
- BASE_BRANCH=$(gh api "repos/$REPO" --jq '.default_branch')
+ BASE_BRANCH=$(gh api "repos/$REPO" --jq '.default_branch' 2>/dev/null || echo "")
43
+
44
+ # If repo is empty or API call failed, default to 'main'
45
+ if [ -z "$BASE_BRANCH" ] || [ "$BASE_BRANCH" = "null" ]; then
46
+ echo "Repository is empty or default branch not found. Defaulting to 'main'"
47
+ BASE_BRANCH="main"
48
+ fi
49
50
echo "repository=$REPO" >> "$GITHUB_OUTPUT"
51
echo "base_branch=$BASE_BRANCH" >> "$GITHUB_OUTPUT"
0 commit comments