Loading...
Loading...
このテンプレートから作ったリポジトリの GitHub 側を gh で設定する。Actions の secrets、Actions による PR 作成の許可、PR を作れる人の制限と auto-merge、既定ブランチのルールセットを揃える。テンプレートから新しいリポジトリを作ったとき、GitHub の設定を揃え直すときに使う。
npx skill4agent add masseater/skills setup-githubghREPO=<owner>/<name>apps/web/app-name.tsAPP_NAMEAPP_NAMEgh secret set OPENROUTER_API_KEY --repo "$REPO"
gh secret set CLAUDE_CODE_OAUTH_TOKEN --repo "$REPO"
gh secret set CLOUDFLARE_ACCOUNT_ID --repo "$REPO"
gh secret set CLOUDFLARE_API_TOKEN --repo "$REPO"| 名前 | 用途 |
|---|---|
| verify ワークフローの oxlint-plugin-decision |
| verify 失敗時に Claude Code が自動修正する |
| デプロイ先と Alchemy の状態を置くアカウント |
| 同じアカウントの API トークン |
gh api --method PUT "repos/$REPO/actions/permissions/workflow" \
-f default_workflow_permissions=read -F can_approve_pull_request_reviews=truegh api --method PATCH "repos/$REPO" -f pull_request_creation_policy=collaborators_only \
-F allow_auto_merge=true -F allow_update_branch=trueup-to-datestrict_required_status_checks_policyup-to-dateid="$(gh api "repos/$REPO/rulesets" --jq '.[] | select(.name == "protect default branch") | .id')"
gh api --method "$([ -n "$id" ] && echo PUT || echo POST)" "repos/$REPO/rulesets${id:+/$id}" --input - <<'JSON'
{
"name": "protect default branch",
"target": "branch",
"enforcement": "active",
"conditions": { "ref_name": { "include": ["~DEFAULT_BRANCH"], "exclude": [] } },
"bypass_actors": [],
"rules": [
{ "type": "deletion" },
{ "type": "non_fast_forward" },
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": true,
"do_not_enforce_on_create": false,
"required_status_checks": [{ "context": "up-to-date", "integration_id": 15368 }]
}
}
]
}
JSONgh api "repos/$REPO" --jq '[.pull_request_creation_policy, .allow_auto_merge]'["collaborators_only",true]gh api "repos/$REPO/rules/branches/main" --jq '[.[].type]'required_status_checks