Skip to content

Commit 411c53a

Browse files
baijumclaude
andcommitted
fix: handle org-disabled projects/discussions in setup script
The GitHub API returns 422 when setting has_projects or has_discussions on repos whose org has these features disabled. Move these to separate calls that silently ignore failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ad38d77 commit 411c53a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

scripts/setup-repo.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ echo
6060

6161
gh api -X PATCH "repos/$FULL_REPO" \
6262
-f has_wiki=false \
63-
-f has_projects=false \
64-
-f has_discussions=false \
6563
-f delete_branch_on_merge=true \
6664
-f allow_squash_merge=true \
6765
-f allow_merge_commit=false \
6866
-f allow_rebase_merge=false \
6967
--silent
7068

71-
info "Repo settings: wiki/projects/discussions disabled, squash-only merge, auto-delete branches"
69+
# These may fail if the org has the feature disabled — that's fine
70+
gh api -X PATCH "repos/$FULL_REPO" -f has_projects=false --silent 2>/dev/null || true
71+
gh api -X PATCH "repos/$FULL_REPO" -f has_discussions=false --silent 2>/dev/null || true
72+
73+
info "Repo settings: wiki disabled, squash-only merge, auto-delete branches"
7274

7375
# --- Branch Protection ---
7476

0 commit comments

Comments
 (0)