Skip to content
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
81f7514
fix: add apply-repo-settings.sh to enforce delete_branch_on_merge
github-actions[bot] Apr 19, 2026
7b75612
fix: add has_discussions=true to apply-repo-settings.sh
github-actions[bot] Apr 19, 2026
32125be
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] Apr 21, 2026
3c66e2a
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] Apr 25, 2026
585d879
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 3, 2026
cec163d
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 4, 2026
42196a6
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 4, 2026
0577152
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 4, 2026
64b0a3d
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 4, 2026
5e657df
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 4, 2026
7602a8c
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 5, 2026
6576104
fix: address Copilot review comments on apply-repo-settings.sh
github-actions[bot] May 6, 2026
1c414b1
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 10, 2026
d7f327f
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 11, 2026
4c4431e
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 11, 2026
0b918fe
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 11, 2026
6f6d391
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 12, 2026
0455d88
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 13, 2026
048c655
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 15, 2026
60ad2d4
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 16, 2026
685b9c7
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 18, 2026
fa14afa
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 18, 2026
b595d78
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 19, 2026
e42b6d6
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 19, 2026
86376d6
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 19, 2026
4e91e67
Merge branch 'main' into claude/issue-90-20260419-1733
github-actions[bot] May 19, 2026
73058b1
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 19, 2026
65e1e6f
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 19, 2026
88ddc7c
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 19, 2026
1b0e329
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 19, 2026
354686c
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 19, 2026
edce2a1
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 19, 2026
624f854
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 20, 2026
07c60fe
Merge branch 'main' into claude/issue-90-20260419-1733
don-petry May 20, 2026
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
83 changes: 83 additions & 0 deletions .github/scripts/apply-repo-settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
# apply-repo-settings.sh — Idempotently apply required repository settings
#
# Enforces all settings required by the petry-projects org standard:
# https://github.com/petry-projects/.github/blob/main/standards/github-settings.md#repository-settings--standard-defaults
#
# Usage:
# GH_TOKEN=<admin-token> bash .github/scripts/apply-repo-settings.sh
#
# The script is safe to run multiple times (idempotent). It fetches and prints
# the current relevant settings, applies the required settings using the
# GitHub REST API, and prints the resulting settings response.
#
# Requirements:
# - GH_TOKEN must have administration:write scope (repo admin role)
# - gh CLI must be installed
# - jq must be installed
#
Comment on lines +14 to +18

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

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

The script relies on jq for pretty-printing output (| jq .), but jq isn’t listed under Requirements. Either add jq to the Requirements section and/or add a clear preflight check (e.g., command -v jq) so the script fails with a helpful message when jq is missing.

Copilot uses AI. Check for mistakes.
# The org-level script (petry-projects/.github/scripts/apply-repo-settings.sh)
# is the canonical tool for managing settings across all repos. This script
# exists as a repo-local reference and fallback for the markets repository.

set -euo pipefail

REPO="petry-projects/markets"

if [ -z "${GH_TOKEN:-}" ]; then
echo "ERROR: GH_TOKEN is required with administration:write scope" >&2
exit 1
fi

if ! command -v jq &>/dev/null; then
echo "ERROR: jq is required but not found in PATH" >&2
exit 1
fi

export GH_TOKEN

echo "Fetching current settings for $REPO ..."
current=$(gh api "repos/$REPO" --jq '{
allow_auto_merge: .allow_auto_merge,
delete_branch_on_merge: .delete_branch_on_merge,
allow_squash_merge: .allow_squash_merge,
allow_merge_commit: .allow_merge_commit,
allow_rebase_merge: .allow_rebase_merge,
has_discussions: .has_discussions,
has_issues: .has_issues,
has_wiki: .has_wiki,
squash_merge_commit_title: .squash_merge_commit_title,
squash_merge_commit_message: .squash_merge_commit_message
}')

echo "Current settings:"
echo "$current" | jq .

echo ""
echo "Applying required settings to $REPO ..."
gh api -X PATCH "repos/$REPO" \
-F delete_branch_on_merge=true \
-F allow_auto_merge=true \
-F allow_squash_merge=true \
-F allow_merge_commit=true \
-F allow_rebase_merge=true \
-F has_discussions=true \
-F has_issues=true \
-F has_wiki=false \
-f squash_merge_commit_title=PR_TITLE \
-f squash_merge_commit_message=COMMIT_MESSAGES \
--jq '{
delete_branch_on_merge,
allow_auto_merge,
allow_squash_merge,
allow_merge_commit,
allow_rebase_merge,
has_discussions,
has_issues,
has_wiki,
squash_merge_commit_title,
squash_merge_commit_message
}' | jq .

echo ""
echo "Done — repository settings applied: https://github.com/$REPO/settings"
Loading