Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,48 @@ gh repo edit --enable-merge-commit --disable-rebase-merge --disable-squash-merge

**Note:** If you prefer rebase merging for linear history, use `--enable-rebase-merge --disable-merge-commit` instead. Ensure consistency with any GitHub Rulesets (see [Rulesets Configuration](#github-rulesets-configuration)).

### Repository Settings

**Complete repository settings:**

| Setting | Value | Rationale |
|---------|-------|-----------|
| Allow merge commits | ✅ | With PR title and description |
| Allow squash merging | ❌ | Preserve commit granularity |
| Allow rebase merging | ❌ | Use merge queue instead |
| Automatically delete head branches | ✅ | Keep repo clean |
| Allow auto-merge | ✅ | Enable merge queue integration |
| Always suggest updating PR branches | ✅ | Keep PRs up-to-date with base |
| Discussions | ✅ | Community Q&A |
| Wikis | ❌ | Use docs folder instead |

**Configure via CLI:**

```bash
# Configure all repository settings
gh repo edit \
--enable-merge-commit \
--disable-squash-merge \
--disable-rebase-merge \
--delete-branch-on-merge \
--enable-auto-merge \
--enable-discussions \
--disable-wiki

# Set merge commit message format (PR title and description)
gh api repos/{owner}/{repo} \
--method PATCH \
-f merge_commit_title=PR_TITLE \
-f merge_commit_message=PR_BODY

# Enable "always suggest updating PR branches"
gh api repos/{owner}/{repo} \
--method PATCH \
-F allow_update_branch=true
```

**Important:** Do NOT enable `required_linear_history` when using merge commits. Linear history requires fast-forward merges only (no merge commits). If you see "not authorized to push" errors, check if `required_linear_history` is enabled and disable it.

### Renaming "master" to "main"

For complete migration steps from `master` to `main` as default branch, see `references/branch-migration.md`.
Expand Down
32 changes: 30 additions & 2 deletions skills/github-project/scripts/verify-github-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ if command -v gh &> /dev/null && [ -n "$REPO_SLUG" ]; then
ALLOW_MERGE=$(echo "$REPO_SETTINGS" | jq -r '.allow_merge_commit // true')
ALLOW_SQUASH=$(echo "$REPO_SETTINGS" | jq -r '.allow_squash_merge // true')
DELETE_ON_MERGE=$(echo "$REPO_SETTINGS" | jq -r '.delete_branch_on_merge // false')
ALLOW_AUTO_MERGE=$(echo "$REPO_SETTINGS" | jq -r '.allow_auto_merge // false')
ALLOW_UPDATE_BRANCH=$(echo "$REPO_SETTINGS" | jq -r '.allow_update_branch // false')
HAS_DISCUSSIONS=$(echo "$REPO_SETTINGS" | jq -r '.has_discussions // false')
HAS_WIKI=$(echo "$REPO_SETTINGS" | jq -r '.has_wiki // false')

if [ "$ALLOW_MERGE" = "true" ]; then
pass "Merge commits enabled"
Expand All @@ -397,6 +401,30 @@ if command -v gh &> /dev/null && [ -n "$REPO_SLUG" ]; then
else
fail "Delete branch on merge disabled (should be enabled)"
fi

if [ "$ALLOW_AUTO_MERGE" = "true" ]; then
pass "Auto-merge enabled"
else
warn "Auto-merge disabled (should be enabled for merge queue)"
fi

if [ "$ALLOW_UPDATE_BRANCH" = "true" ]; then
pass "Always suggest updating PR branches enabled"
else
warn "Always suggest updating PR branches disabled"
fi

if [ "$HAS_DISCUSSIONS" = "true" ]; then
pass "Discussions enabled"
else
warn "Discussions disabled (should be enabled)"
fi

if [ "$HAS_WIKI" = "false" ]; then
pass "Wiki disabled (use docs folder instead)"
else
warn "Wiki enabled (consider disabling - use docs folder)"
fi
else
warn "Could not fetch GitHub repo settings (check gh auth)"
fi
Expand All @@ -417,8 +445,8 @@ echo " - Require review from CODEOWNERS"
echo " - Require conversation resolution"
echo " - Do not allow force pushes"
echo " - Do not allow deletions"
echo " - Allow merge commits only (disable rebase & squash)"
echo " - Delete branch on merge"
echo " - Enable merge queue (with MERGE method)"
echo " - Do NOT enable 'Require linear history' (conflicts with merge commits)"
info "Check with: gh api repos/{owner}/{repo}/branches/main/protection"

# Check if local indicators suggest protection is needed
Expand Down