Skip to content

Instantly share code, notes, and snippets.

@austoonz
Last active March 25, 2026 16:04
Show Gist options
  • Select an option

  • Save austoonz/26d9de0c88e621ca3bc3b4bbec2a32ca to your computer and use it in GitHub Desktop.

Select an option

Save austoonz/26d9de0c88e621ca3bc3b4bbec2a32ca to your computer and use it in GitHub Desktop.
Create GitHub repo with Forge & Sentinel GitHub App setup
param(
[Parameter(Mandatory)][string]$RepoName
)
$Owner = gh api /user --jq .login
gh repo create "$Owner/$RepoName" --private --clone
Set-Location $RepoName
$RepoId = gh api "/repos/$Owner/$RepoName" --jq .id
# Set merge and squash commit messages to use PR title and description
gh api --method PATCH "/repos/$Owner/$RepoName" `
--field merge_commit_title="PR_TITLE" `
--field merge_commit_message="PR_BODY" `
--field squash_merge_commit_title="PR_TITLE" `
--field squash_merge_commit_message="PR_BODY" | Out-Null
Write-Host "✓ Configured merge commit messages"
foreach ($AppSlug in @('arbina-forge', 'arbina-sentinel')) {
$Filter = ".installations[] | select(.app_slug == `"$AppSlug`") | .id"
$InstallId = gh api /user/installations --jq $Filter
if ($InstallId) {
gh api --method PUT "/user/installations/$InstallId/repositories/$RepoId"
Write-Host "✓ Installed $AppSlug"
} else {
Write-Warning "App '$AppSlug' not found"
}
}
# Create labels
foreach ($Label in @('forge', 'sentinel', 'forge-nit')) {
gh label create $Label --repo "$Owner/$RepoName" --color "ededed" --force
}
Write-Host "Done — $Owner/$RepoName is ready"
#!/usr/bin/env bash
set -euo pipefail
REPO_NAME="${1:?Usage: $0 <repo-name>}"
OWNER=$(gh api /user --jq .login)
gh repo create "$OWNER/$REPO_NAME" --private --clone
cd "$REPO_NAME"
REPO_ID=$(gh api "/repos/$OWNER/$REPO_NAME" --jq .id)
# Set merge and squash commit messages to use PR title and description
gh api --method PATCH "/repos/$OWNER/$REPO_NAME" \
--field merge_commit_title="PR_TITLE" \
--field merge_commit_message="PR_BODY" \
--field squash_merge_commit_title="PR_TITLE" \
--field squash_merge_commit_message="PR_BODY" > /dev/null
echo "✓ Configured merge commit messages"
for APP_SLUG in arbina-forge arbina-sentinel; do
INSTALL_ID=$(gh api /user/installations --jq ".installations[] | select(.app_slug == \"$APP_SLUG\") | .id")
if [[ -n "$INSTALL_ID" ]]; then
gh api --method PUT "/user/installations/$INSTALL_ID/repositories/$REPO_ID"
echo "✓ Installed $APP_SLUG"
else
echo "⚠ App '$APP_SLUG' not found"
fi
done
# Create labels
for LABEL in forge sentinel forge-nit; do
gh label create "$LABEL" --repo "$OWNER/$REPO_NAME" --color "ededed" --force
done
echo "Done — $OWNER/$REPO_NAME is ready"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment