diff --git a/.github/config/branch-protection/main.json b/.github/config/branch-protection/main.json new file mode 100644 index 0000000..ba8743c --- /dev/null +++ b/.github/config/branch-protection/main.json @@ -0,0 +1,20 @@ +{ + "allow_force_pushes": false, + "allow_deletions": false, + "block_creations": false, + "enforce_admins": false, + "required_conversation_resolution": false, + "required_linear_history": true, + "required_pull_request_reviews": { + "dismiss_stale_reviews": true, + "require_code_owner_reviews": true, + "required_approving_review_count": 1, + "require_last_push_approval": false + }, + "required_signatures": true, + "required_status_checks": { + "strict": true, + "checks": [] + }, + "restrictions": null +} diff --git a/.github/config/repo.json b/.github/config/repo.json new file mode 100644 index 0000000..77abe12 --- /dev/null +++ b/.github/config/repo.json @@ -0,0 +1,25 @@ +{ + "allow_auto_merge": false, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_squash_merge": true, + "allow_update_branch": true, + "default_branch": "main", + "delete_branch_on_merge": true, + "description": "A GitHub CLI extension to manage repository settings", + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "homepage": "", + "security_and_analysis": { + "advanced_security": { + "status": "enabled" + }, + "secret_scanning": { + "status": "enabled" + } + }, + "squash_merge_commit_message": "BLANK", + "squash_merge_commit_title": "PR_TITLE", + "web_commit_signoff_required": false +} diff --git a/.github/config/topics.json b/.github/config/topics.json new file mode 100644 index 0000000..7ae61ba --- /dev/null +++ b/.github/config/topics.json @@ -0,0 +1,7 @@ +{ + "names": [ + "github", + "cli", + "gh-extension" + ] +} diff --git a/Makefile b/Makefile index c556cd6..e1a963f 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ SHELL := /bin/bash fixtures: ## Recreate test fixtures rm -Rf ./tests/fixtures ./gh-repo-config init --config ./tests/fixtures + cp ./tests/fixtures/branch-protection/main.json ./tests/fixtures/branch-protection/prod.json .PHONY: format format: ## Format source code diff --git a/gh-repo-config b/gh-repo-config index 144c3e2..52ff0eb 100755 --- a/gh-repo-config +++ b/gh-repo-config @@ -58,33 +58,22 @@ JSON_BRANCH_PROTECTION=$( { "allow_force_pushes": false, "allow_deletions": false, - "block_creations": true, + "block_creations": false, "enforce_admins": false, "required_conversation_resolution": false, "required_linear_history": true, "required_pull_request_reviews": { - "dismissal_restrictions": { - "users": [], - "teams": [] - }, "dismiss_stale_reviews": true, "require_code_owner_reviews": true, - "required_approving_review_count": 2, - "require_last_push_approval": false, - "bypass_pull_request_allowances": { - "users": [], - "teams": [] - } + "required_approving_review_count": 1, + "require_last_push_approval": false }, "required_signatures": true, "required_status_checks": { "strict": true, "checks": [] }, - "restrictions": { - "users": [], - "teams": [] - } + "restrictions": null } EOL ) @@ -112,9 +101,6 @@ log:api() { } app::apply() { - echo "APP_ENV: ${APP_ENV}" - echo "_GH: ${_GH}" - repo=$("${_GH}" repo view --json nameWithOwner --jq .nameWithOwner) if [ -f "${APP_CONFIG}/repo.json" ]; then @@ -173,6 +159,7 @@ app::help() { echo " -c, --config