github-research-tool/advanced/github-features-detailed.md
marketing-shibata50 99d3e4b78b feat: complete guide navigation and cross-links
Updated index.md and github-features-simple.md to include comprehensive navigation between all guide levels (beginner/advanced), creating clear learning paths for users

🀖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-20 20:01:02 +09:00

45 KiB
Raw Permalink Blame History

layout title description
default GitHub機胜詳现ガむド - å…š20機胜の完党解説 GitHubの党機胜を実䟋ずベストプラクティスず共に培底解説

📚 GitHub機胜詳现ガむド - å…š20機胜の完党解説

GitHubの党20機胜に぀いお、実践的な䜿い方からプロレベルの掻甚法たで培底的に解説したす。


📋 目次

基本機胜1-6

  1. リポゞトリRepository
  2. ブランチBranch
  3. コミットCommit
  4. プルリク゚ストPull Request
  5. むシュヌIssues
  6. プロゞェクトProjects

自動化・公開機胜7-9

  1. アクションActions
  2. ペヌゞPages
  3. りィキWiki

゜ヌシャル機胜10-12

  1. りォッチWatch
  2. スタヌStar
  3. フォヌクFork

Git操䜜機胜13-16

  1. クロヌンClone
  2. プッシュPush
  3. プルPull
  4. マヌゞMerge

拡匵機胜17-20

  1. ディスカッションDiscussions
  2. ギストGist
  3. パッケヌゞPackages
  4. スポンサヌSponsors

1. 📁 リポゞトリRepository

抂芁

リポゞトリは、プロゞェクトの党ファむル、履歎、蚭定を保存する基本単䜍です。Googleドラむブのフォルダに䌌おいたすが、倉曎履歎を完党に蚘録し、耇数人での同時線集を可胜にしたす。

詳现機胜

リポゞトリの皮類

┌─────────────────────────────────────────────┐
│             リポゞトリタむプ                 │
├─────────────────┬────────────────────────────
│   Public        │   Private                 │
├─────────────────┌────────────────────────────
│ ✓ 誰でも閲芧可  │ ✓ 招埅者のみ閲芧可        │
│ ✓ 怜玢可胜      │ ✗ 怜玢䞍可               │
│ ✓ 無料・無制限  │ ✓ 無料個人            │
│ ✓ GitHub Pages │ ✓ Pro版でPages可         │
└─────────────────┮───────────────────────────┘

必須ファむル構成

my-project/
├── README.md          # プロゞェクト説明必須
├── LICENSE           # ラむセンス情報
├── .gitignore        # 無芖ファむル蚭定
├── .github/          # GitHub蚭定
│   ├── workflows/    # Actions蚭定
│   ├── ISSUE_TEMPLATE/
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── CODEOWNERS   # コヌドオヌナヌ
├── docs/            # ドキュメント
├── src/             # ゜ヌスコヌド
└── tests/           # テストコヌド

実践䟋

1. テンプレヌトからリポゞトリ䜜成

# GitHub CLIを䜿甚
gh repo create my-app --template owner/template-repo --public

# テンプレヌト䜿甚の利点
- 暙準構成の即時適甚
- CI/CD蚭定の継承
- コヌディング芏玄の統䞀

2. モノレポ構成

company-monorepo/
├── packages/
│   ├── frontend/      # Reactアプリ
│   ├── backend/       # Node.js API
│   ├── mobile/        # React Native
│   └── shared/        # 共通ラむブラリ
├── lerna.json         # Lernaモノレポ蚭定
└── package.json       # ルヌト蚭定

3. リポゞトリ蚭定のベストプラクティス

# .github/settings.yml (probot/settings䜿甚)
repository:
  name: my-project
  description: プロゞェクトの説明
  private: false
  has_issues: true
  has_projects: true
  has_wiki: true
  has_downloads: true
  default_branch: main
  allow_squash_merge: true
  allow_merge_commit: true
  allow_rebase_merge: false
  delete_branch_on_merge: true
  enable_automated_security_fixes: true

高床な掻甚

1. リポゞトリむンサむト分析

Insights → 各皮分析
├── Pulse: 週次/月次アクティビティ
├── Contributors: 貢献者統蚈
├── Community: コミュニティ健党性
├── Traffic: アクセス統蚈
├── Commits: コミット頻床
├── Code frequency: コヌド远加/削陀
└── Dependency graph: 䟝存関係

2. セキュリティ蚭定

# Security → Settings
- ✓ Dependency alerts
- ✓ Dependabot security updates
- ✓ Code scanning alerts
- ✓ Secret scanning alerts

3. アクセス管理

Settings → Manage access
├── Collaborators: 個別招埅
├── Teams: チヌム単䜍管理
└── Deploy keys: CI/CD甚鍵

トラブルシュヌティング

リポゞトリサむズ問題

# 倧きなファむルの履歎削陀
git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch path/to/large-file" \
  --prune-empty --tag-name-filter cat -- --all

# Git LFS導入
git lfs track "*.psd"
git lfs track "*.zip"
git add .gitattributes

2. 🌿 ブランチBranch

抂芁

ブランチは、メむンのコヌドから分岐しお独立した開発を行うための仕組みです。耇数の機胜を䞊行開発したり、実隓的な倉曎を安党に詊すこずができたす。

ブランチ戊略

1. Git Flow

main (production)
│
├── develop (開発統合)
│   ├── feature/user-auth
│   ├── feature/payment
│   └── feature/notifications
│
├── release/v1.2.0
│   └── 本番リリヌス準備
│
└── hotfix/critical-bug
    └── 緊急修正

2. GitHub Flowシンプル

main
├── feature/new-feature
├── fix/bug-123
└── docs/update-readme

3. GitLab Flow環境別

main
├── pre-production
├── production
└── feature-branches

実践的なブランチ運甚

ブランチ呜名芏則

# 機胜远加
feature/user-authentication
feature/JIRA-123-shopping-cart

# バグ修正
fix/login-error
bugfix/issue-456

# ドキュメント
docs/api-documentation
docs/installation-guide

# リファクタリング
refactor/database-optimization
chore/update-dependencies

# リリヌス
release/v2.0.0
release/2023-12-01

ブランチ保護ルヌル

# branch protection rules
main:
  required_reviews: 2
  dismiss_stale_reviews: true
  require_code_owner_reviews: true
  required_status_checks:
    - continuous-integration/travis-ci
    - security/snyk
  enforce_admins: false
  restrictions:
    users: []
    teams: ["maintainers"]

高床なブランチ操䜜

1. ブランチの比范ずマヌゞ予枬

# ブランチ間の差分確認
git diff main..feature/new-feature

# マヌゞ予枬ドラむラン
git merge --no-commit --no-ff feature/new-feature
git diff --cached
git merge --abort  # 取り消し

# コンフリクト事前確認
git log --oneline --left-right main...feature/new-feature

2. ブランチのクリヌンアップ

# マヌゞ枈みブランチ䞀芧
git branch --merged main

# リモヌトの削陀枈みブランチを反映
git remote prune origin

# 䞀括削陀スクリプト
git branch --merged main | grep -v "main\|develop" | xargs -n 1 git branch -d

3. ブランチ埩元

# 削陀したブランチを埩元
git reflog
git checkout -b recovered-branch HEAD@{2}

ワヌクフロヌ䟋

フィヌチャヌブランチワヌクフロヌ

# 1. 最新のmainから分岐
git checkout main
git pull origin main
git checkout -b feature/awesome-feature

# 2. 開発䜜業
# ... コヌド倉曎 ...
git add .
git commit -m "feat: add awesome feature"

# 3. 定期的にmainの倉曎を取り蟌む
git checkout main
git pull origin main
git checkout feature/awesome-feature
git rebase main

# 4. プッシュしおPR䜜成
git push origin feature/awesome-feature
gh pr create --fill

3. 💟 コミットCommit

抂芁

コミットは、ファむルの倉曎を履歎ずしお蚘録する操䜜です。各コミットは䞀意のIDを持ち、い぀でも過去の状態に戻すこずができたす。

コミットメッセヌゞの芏玄

Conventional Commits

<type>(<scope>): <subject>

<body>

<footer>

タむプ䞀芧

feat:     新機胜
fix:      バグ修正
docs:     ドキュメントのみの倉曎
style:    フォヌマット倉曎コヌドの動䜜に圱響なし
refactor: リファクタリング
perf:     パフォヌマンス改善
test:     テスト远加・修正
chore:    ビルドプロセスやツヌルの倉曎
ci:       CI蚭定の倉曎

実䟋

# 良い䟋
git commit -m "feat(auth): add OAuth2 login support

- Implement Google OAuth2 integration
- Add refresh token handling
- Update user model with OAuth fields

Closes #123"

# 悪い䟋
git commit -m "曎新"
git commit -m "fix"

高床なコミット操䜜

1. むンタラクティブリベヌス

# 盎近3぀のコミットを敎理
git rebase -i HEAD~3

# ゚ディタで操䜜を遞択
pick abc1234 feat: add login
squash def5678 fix: typo
reword ghi9012 docs: update

# 結果: 3぀のコミットが2぀に敎理される

2. コミットの分割

# 倧きすぎるコミットを分割
git reset HEAD~1
git add -p  # 郚分的にステヌゞング
git commit -m "feat: add user model"
git add -p
git commit -m "feat: add user controller"

3. コミットの怜玢

# メッセヌゞで怜玢
git log --grep="fix.*login"

# 倉曎内容で怜玢
git log -S "function loginUser"

# 日付範囲
git log --since="2023-01-01" --until="2023-12-31"

# 著者
git log --author="John Doe"

コミットフック

pre-commit蚭定

# .git/hooks/pre-commit
#!/bin/sh
# コヌド品質チェック
npm run lint
npm run test:unit

# コミットメッセヌゞ怜蚌
commit_regex='^(feat|fix|docs|style|refactor|perf|test|chore|ci)(\(.+\))?: .{1,50}'
if ! grep -qE "$commit_regex" "$1"; then
    echo "Invalid commit message format!"
    exit 1
fi

眲名付きコミット

# GPG眲名の蚭定
git config --global user.signingkey YOUR_GPG_KEY
git config --global commit.gpgsign true

# 眲名付きコミット
git commit -S -m "feat: secure feature"

# 眲名の怜蚌
git log --show-signature

4. 🔄 プルリク゚ストPull Request

抂芁

プルリク゚ストPRは、ブランチの倉曎をメむンブランチに統合する前に、コヌドレビュヌや議論を行うための機胜です。

PR䜜成のベストプラクティス

PRテンプレヌト

<!-- .github/pull_request_template.md -->
## 抂芁
<!-- 倉曎の抂芁を蚘述 -->

## 倉曎タむプ
- [ ] 🐛 バグ修正
- [ ] ✹ 新機胜
- [ ] 💥 砎壊的倉曎
- [ ] 📝 ドキュメント曎新

## 関連Issue
Closes #

## 倉曎内容
<!-- 詳现な倉曎内容 -->

## スクリヌンショット
<!-- UI倉曎の堎合 -->

## テスト
- [ ] ナニットテスト远加/曎新
- [ ] 統合テスト実斜
- [ ] 手動テスト完了

## チェックリスト
- [ ] セルフレビュヌ実斜
- [ ] コヌディング芏玄準拠
- [ ] ドキュメント曎新
- [ ] 倉曎履歎CHANGELOG曎新

PR自動化

自動ラベリング
# .github/labeler.yml
frontend:
  - src/components/**
  - src/pages/**

backend:
  - api/**
  - server/**

documentation:
  - docs/**
  - '*.md'

tests:
  - '**/*.test.js'
  - '**/*.spec.ts'
自動アサむン
# .github/CODEOWNERS
# フロント゚ンド
/src/components/ @frontend-team
/src/pages/ @frontend-team

# バック゚ンド
/api/ @backend-team @tech-lead

# ドキュメント
/docs/ @docs-team
*.md @docs-team

高床なPR管理

1. Draft PR掻甚

# Draft PRずしお䜜成
gh pr create --draft --title "WIP: New feature"

# 準備完了埌
gh pr ready 123

2. スタック型PR䟝存PR

main
└── PR #1: feature/database-schema
    └── PR #2: feature/api-endpoints
        └── PR #3: feature/frontend-ui

3. PR自動マヌゞ蚭定

# .github/auto-merge.yml
merge_rules:
  - name: 自動マヌゞdependabot
    conditions:
      - author = dependabot[bot]
      - status-check = continuous-integration/travis-ci
      - '#approved-reviews >= 1'
    actions:
      merge:
        method: squash

コヌドレビュヌのベストプラクティス

レビュヌコメントの曞き方

# 建蚭的なコメント䟋

## 🀔 質問
このアプロヌチを遞んだ理由を教えおいただけたすか
別の方法ずしお〇〇も考えられたすが、怜蚎されたしたか

## 💡 提案
```suggestion
const result = users.filter(u => u.active).map(u => u.name);

パフォヌマンスを考慮しお、filterずmapを1回のreduceにたずめるこずを提案したす。

⚠ 懞念事項

このコヌドはN+1問題を匕き起こす可胜性がありたす。 デヌタロヌダヌの䜿甚を怜蚎しおください。

✅ 良い点

゚ラヌハンドリングが適切に実装されおいお玠晎らしいです


---

## 5. 🎫 むシュヌIssues

### 抂芁
Issuesは、バグ報告、機胜芁望、タスク管理、質問など、プロゞェクトに関するあらゆる議論を管理する機胜です。

### Issue掻甚パタヌン

#### 1. バグ報告テンプレヌト
```markdown
<!-- .github/ISSUE_TEMPLATE/bug_report.md -->
---
name: バグ報告
about: バグの報告はこちら
title: '[BUG] '
labels: bug, triage
assignees: ''
---

## バグの抂芁
<!-- 簡朔な説明 -->

## 再珟手順
1. 
2. 
3. 

## 期埅される動䜜
<!-- 正垞な動䜜 -->

## 実際の動䜜
<!-- バグの動䜜 -->

## 環境
- OS: [e.g. macOS 13.0]
- ブラりザ: [e.g. Chrome 100]
- バヌゞョン: [e.g. 1.0.0]

## スクリヌンショット
<!-- 該圓する堎合 -->

## ログ

゚ラヌログをここに貌付

2. 機胜芁望テンプレヌト

<!-- .github/ISSUE_TEMPLATE/feature_request.md -->
---
name: 機胜芁望
about: 新機胜の提案
title: '[FEATURE] '
labels: enhancement
---

## 機胜の抂芁
<!-- 提案する機胜の説明 -->

## 解決したい課題
<!-- この機胜で解決される問題 -->

## 提案する解決策
<!-- 実装方法の提案 -->

## 代替案
<!-- 他の解決方法 -->

## 远加情報
<!-- 参考資料やリンク -->

高床なIssue管理

1. ラベル䜓系

# 優先床
- P0: Critical
- P1: High
- P2: Medium
- P3: Low

# タむプ
- bug: バグ
- enhancement: 機胜改善
- documentation: ドキュメント
- question: 質問

# 状態
- triage: トリアヌゞ埅ち
- in-progress: 䜜業䞭
- blocked: ブロック䞭
- ready-for-review: レビュヌ埅ち

# コンポヌネント
- frontend
- backend
- database
- infrastructure

2. 自動化ルヌル

# .github/workflows/issue-automation.yml
name: Issue Automation

on:
  issues:
    types: [opened, labeled]

jobs:
  auto-assign:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/github-script@v6
        with:
          script: |
            // ラベルに基づく自動アサむン
            const labelAssignees = {
              'frontend': ['frontend-lead'],
              'backend': ['backend-lead'],
              'urgent': ['tech-lead', 'manager']
            };
            
            const labels = context.payload.issue.labels;
            const assignees = new Set();
            
            labels.forEach(label => {
              const users = labelAssignees[label.name];
              if (users) users.forEach(u => assignees.add(u));
            });
            
            if (assignees.size > 0) {
              await github.rest.issues.addAssignees({
                ...context.repo,
                issue_number: context.issue.number,
                assignees: Array.from(assignees)
              });
            }

3. Issue分析ダッシュボヌド

// GitHub GraphQL APIを䜿甚した分析
const query = `
  query($owner: String!, $repo: String!) {
    repository(owner: $owner, name: $repo) {
      issues(first: 100, states: OPEN) {
        totalCount
        edges {
          node {
            createdAt
            closedAt
            labels(first: 10) {
              nodes { name }
            }
            assignees(first: 5) {
              nodes { login }
            }
          }
        }
      }
    }
  }
`;

// 平均解決時間、ラベル別統蚈などを蚈算

6. 📋 プロゞェクトProjects

抂芁

GitHub Projectsは、カンバンボヌドやテヌブル圢匏でタスクを芖芚的に管理できる機胜です。IssueやPRず連携しお、プロゞェクト党䜓の進捗を把握できたす。

Projects v2の掻甚

ビュヌタむプ

1. Board Viewカンバン
   └── ドラッグ&ドロップで盎感的

2. Table View衚圢匏
   └── フィルタ・゜ヌトで分析

3. Roadmap Viewタむムラむン
   └── スケゞュヌル管理

カスタムフィヌルド

fields:
  - name: Priority
    type: single_select
    options: [High, Medium, Low]
  
  - name: Story Points
    type: number
  
  - name: Sprint
    type: iteration
    duration: 2 weeks
  
  - name: Start Date
    type: date
  
  - name: Team
    type: single_select
    options: [Frontend, Backend, QA, DevOps]

実践的なプロゞェクト蚭定

スクラム開発テンプレヌト

📋 Sprint Board
├── 📥 Backlog
├── 🎯 Sprint Planning
├── 🚧 In Progress
├── 👀 In Review
├── ✅ Done
└── 🚢 Deployed

自動化ワヌクフロヌ

# プロゞェクト自動化
workflows:
  - name: 新芏Issue远加
    trigger: item_added
    if: item.type == "issue"
    then:
      - set_field: "Status", "Backlog"
      - set_field: "Priority", "Medium"
  
  - name: PR䜜成時
    trigger: item_added
    if: item.type == "pull_request"
    then:
      - set_field: "Status", "In Review"
      - link_to_issue
  
  - name: 完了時
    trigger: item_closed
    then:
      - set_field: "Status", "Done"
      - set_field: "Completed Date", current_date()

高床な掻甚䟋

1. ベロシティトラッキング

// スプリント別の完了ポむント集蚈
const calculateVelocity = (projectItems) => {
  const sprintVelocity = {};
  
  projectItems
    .filter(item => item.status === 'Done')
    .forEach(item => {
      const sprint = item.fields.sprint;
      const points = item.fields.storyPoints || 0;
      sprintVelocity[sprint] = (sprintVelocity[sprint] || 0) + points;
    });
    
  return sprintVelocity;
};

2. バヌンダりンチャヌト

graph LR
    A[Sprint Start: 50pts] --> B[Day 3: 42pts]
    B --> C[Day 6: 28pts]
    C --> D[Day 9: 15pts]
    D --> E[Sprint End: 0pts]

3. 耇数リポゞトリ統合

# Organization-level project
repositories:
  - frontend-app
  - backend-api
  - mobile-app
  - shared-components

sync_rules:
  - source: "*/issues"
    filter: "label:epic"
    destination: "Epic Board"

7. ⚡ アクションActions

抂芁

GitHub Actionsは、CI/CD、自動化、定期実行など、あらゆるワヌクフロヌを実行できる匷力な自動化プラットフォヌムです。

基本構造

name: ワヌクフロヌ名
on: [トリガヌむベント]
env:
  GLOBAL_VAR: value

jobs:
  job-name:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: ステップ名
        run: |
          実行コマンド

実践的なワヌクフロヌ䟋

1. マルチ環境CI/CD

name: CI/CD Pipeline

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

env:
  NODE_VERSION: '18'
  
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node: [16, 18, 20]
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node }}
        cache: 'npm'
    
    - name: Install dependencies
      run: npm ci
    
    - name: Run tests
      run: |
        npm run lint
        npm run test:unit
        npm run test:integration
    
    - name: Upload coverage
      uses: codecov/codecov-action@v3
      with:
        token: ${{ secrets.CODECOV_TOKEN }}

  build:
    needs: test
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Build application
      run: |
        npm ci
        npm run build
    
    - name: Build Docker image
      run: |
        docker build -t ${{ github.repository }}:${{ github.sha }} .
        docker tag ${{ github.repository }}:${{ github.sha }} ${{ github.repository }}:latest
    
    - name: Push to registry
      if: github.ref == 'refs/heads/main'
      run: |
        echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
        docker push ${{ github.repository }}:${{ github.sha }}
        docker push ${{ github.repository }}:latest

  deploy:
    needs: build
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    environment: production
    
    steps:
    - name: Deploy to Kubernetes
      run: |
        kubectl set image deployment/app app=${{ github.repository }}:${{ github.sha }}
        kubectl rollout status deployment/app

2. 定期実行ワヌクフロヌ

name: Scheduled Tasks

on:
  schedule:
    # 毎日 9:00 JST
    - cron: '0 0 * * *'
    # 毎週月曜 10:00 JST
    - cron: '0 1 * * 1'

jobs:
  security-scan:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Run security audit
      run: |
        npm audit
        pip-audit
        bundle-audit check
    
    - name: Dependency check
      uses: dependency-check/Dependency-Check_Action@main
      with:
        project: 'my-project'
        path: '.'
        format: 'HTML'
    
    - name: Upload reports
      uses: actions/upload-artifact@v3
      with:
        name: security-reports
        path: reports/

  backup:
    runs-on: ubuntu-latest
    steps:
    - name: Backup database
      run: |
        pg_dump ${{ secrets.DATABASE_URL }} > backup.sql
        aws s3 cp backup.sql s3://backups/$(date +%Y%m%d).sql

3. 高床な条件分岐

name: Conditional Workflow

on: [push, pull_request]

jobs:
  determine-changes:
    runs-on: ubuntu-latest
    outputs:
      frontend: ${{ steps.filter.outputs.frontend }}
      backend: ${{ steps.filter.outputs.backend }}
      docs: ${{ steps.filter.outputs.docs }}
    
    steps:
    - uses: actions/checkout@v4
    - uses: dorny/paths-filter@v2
      id: filter
      with:
        filters: |
          frontend:
            - 'src/**'
            - 'public/**'
            - 'package.json'
          backend:
            - 'api/**'
            - 'server/**'
            - 'requirements.txt'
          docs:
            - 'docs/**'
            - '*.md'

  frontend-tests:
    needs: determine-changes
    if: needs.determine-changes.outputs.frontend == 'true'
    runs-on: ubuntu-latest
    steps:
    - run: echo "Frontend changed, running tests..."

  backend-tests:
    needs: determine-changes
    if: needs.determine-changes.outputs.backend == 'true'
    runs-on: ubuntu-latest
    steps:
    - run: echo "Backend changed, running tests..."

カスタムアクション開発

JavaScript Action

# action.yml
name: 'Custom Action'
description: 'カスタムアクションの説明'
inputs:
  token:
    description: 'GitHub token'
    required: true
outputs:
  result:
    description: '凊理結果'
runs:
  using: 'node16'
  main: 'dist/index.js'
// index.js
const core = require('@actions/core');
const github = require('@actions/github');

async function run() {
  try {
    const token = core.getInput('token');
    const octokit = github.getOctokit(token);
    
    // カスタムロゞック
    const result = await processData(octokit);
    
    core.setOutput('result', result);
  } catch (error) {
    core.setFailed(error.message);
  }
}

run();

8. 🌐 ペヌゞPages

抂芁

GitHub Pagesは、リポゞトリから盎接静的Webサむトをホスティングできる無料サヌビスです。

蚭定パタヌン

1. 基本蚭定

# _config.yml (Jekyll)
title: My Awesome Site
description: サむトの説明
url: https://username.github.io
baseurl: /repository-name

theme: minima
plugins:
  - jekyll-feed
  - jekyll-sitemap
  - jekyll-seo-tag

2. カスタムドメむン蚭定

# CNAME
www.example.com
# DNS蚭定
A     @     185.199.108.153
A     @     185.199.109.153
A     @     185.199.110.153
A     @     185.199.111.153
CNAME www   username.github.io

高床な掻甚

1. 耇数の静的サむトゞェネレヌタ

# Hugo
name: Deploy Hugo site

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        submodules: true
    
    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2
      with:
        hugo-version: 'latest'
        extended: true
    
    - name: Build
      run: hugo --minify
    
    - name: Deploy
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./public

2. SPASingle Page Application

# React/Vue/Angular
name: Deploy SPA

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '18'
        cache: 'npm'
    
    - name: Install and Build
      run: |
        npm ci
        npm run build
      env:
        REACT_APP_API_URL: ${{ secrets.API_URL }}
    
    - name: Deploy
      uses: JamesIves/github-pages-deploy-action@v4
      with:
        folder: build
        clean: true

3. ドキュメントサむト

# VitePress/Docusaurus
name: Deploy Docs

on:
  push:
    branches: [main]
    paths:
      - 'docs/**'
      - 'package.json'

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Build VitePress site
      run: |
        npm ci
        npm run docs:build
    
    - name: Deploy to GitHub Pages
      uses: crazy-max/ghaction-github-pages@v3
      with:
        target_branch: gh-pages
        build_dir: docs/.vitepress/dist
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

パフォヌマンス最適化

# 最適化蚭定
optimization:
  - HTML minification
  - CSS/JS minification
  - Image optimization
  - Lazy loading
  - Service Worker
  - CDN integration

# キャッシュ蚭定
cache_control:
  - "*.html": "no-cache"
  - "*.css": "max-age=31536000"
  - "*.js": "max-age=31536000"
  - "*.jpg": "max-age=31536000"

9. 📚 りィキWiki

抂芁

GitHubのWikiは、プロゞェクトの詳现なドキュメントを䜜成・管理するための機胜です。リポゞトリずは独立したGitリポゞトリずしお管理されたす。

Wiki構成のベストプラクティス

ディレクトリ構造

Home.md
├── Getting-Started/
│   ├── Installation.md
│   ├── Configuration.md
│   └── Quick-Start.md
├── User-Guide/
│   ├── Basic-Usage.md
│   ├── Advanced-Features.md
│   └── Troubleshooting.md
├── API-Reference/
│   ├── REST-API.md
│   ├── GraphQL-API.md
│   └── Webhooks.md
└── Contributing/
    ├── Code-Style.md
    ├── Testing.md
    └── Release-Process.md

高床なWiki管理

1. Wikiの自動生成

name: Generate Wiki

on:
  push:
    branches: [main]
    paths:
      - 'src/**'
      - 'docs/**'

jobs:
  wiki:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Generate API docs
      run: |
        npm run docs:generate
        
    - name: Sync to Wiki
      uses: SwiftDocOrg/github-wiki-publish-action@v1
      with:
        path: docs/generated
      env:
        GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PAT }}

2. Wiki怜玢機胜の実装

// Wiki内怜玢カスタム実装
class WikiSearch {
  constructor(pages) {
    this.index = this.buildIndex(pages);
  }
  
  buildIndex(pages) {
    return pages.map(page => ({
      title: page.title,
      content: page.content.toLowerCase(),
      tokens: this.tokenize(page.content),
      url: page.url
    }));
  }
  
  search(query) {
    const queryTokens = this.tokenize(query.toLowerCase());
    return this.index
      .map(page => ({
        ...page,
        score: this.calculateScore(page.tokens, queryTokens)
      }))
      .filter(page => page.score > 0)
      .sort((a, b) => b.score - a.score);
  }
}

10. 👁 りォッチWatch

抂芁

Watchは、リポゞトリの掻動を監芖し、通知を受け取るための機胜です。

通知レベルの詳现

┌─────────────────────────────────────────────────┐
│              Watch蚭定レベル                      │
├──────────────┬───────────────────────────────────
│ Not watching │ 参加しおいるIssue/PRのみ通知      │
│ Releases only│ リリヌス時のみ通知               │
│ Watching     │ すべおの掻動を通知               │
│ Ignoring     │ 通知を完党に無効化               │
└──────────────┮──────────────────────────────────┘

カスタム通知蚭定

1. 通知フィルタリング

// GitHub API を䜿甚した通知管理
const filterNotifications = async (octokit) => {
  const notifications = await octokit.rest.activity.listNotificationsForAuthenticatedUser();
  
  return notifications.data.filter(notification => {
    // 重芁床でフィルタ
    if (notification.reason === 'security_alert') return true;
    if (notification.reason === 'mention') return true;
    if (notification.reason === 'review_requested') return true;
    
    // それ以倖は無芖
    return false;
  });
};

2. 通知の自動凊理

name: Process Notifications

on:
  schedule:
    - cron: '*/30 * * * *'  # 30分ごず

jobs:
  process:
    runs-on: ubuntu-latest
    steps:
    - name: Auto-respond to notifications
      uses: actions/github-script@v6
      with:
        script: |
          const notifications = await github.rest.activity.listNotificationsForAuthenticatedUser();
          
          for (const notification of notifications.data) {
            if (notification.reason === 'ci_activity' && notification.subject.title.includes('passed')) {
              // CI成功通知は既読にする
              await github.rest.activity.markThreadAsRead({
                thread_id: notification.id
              });
            }
          }

11. ⭐ スタヌStar

抂芁

Starは、気に入ったリポゞトリをブックマヌクし、プロゞェクトぞの支持を衚明する機胜です。

スタヌの掻甚方法

1. スタヌ履歎の分析

import requests
import matplotlib.pyplot as plt
from datetime import datetime

def analyze_star_history(owner, repo):
    # GitHub APIでスタヌ履歎を取埗
    headers = {'Accept': 'application/vnd.github.star+json'}
    stars = []
    page = 1
    
    while True:
        response = requests.get(
            f'https://api.github.com/repos/{owner}/{repo}/stargazers',
            headers=headers,
            params={'per_page': 100, 'page': page}
        )
        
        if not response.json():
            break
            
        stars.extend(response.json())
        page += 1
    
    # 日付ごずに集蚈
    dates = [datetime.fromisoformat(s['starred_at'].replace('Z', '')) for s in stars]
    cumulative_stars = range(1, len(dates) + 1)
    
    # グラフ化
    plt.plot(dates, cumulative_stars)
    plt.xlabel('Date')
    plt.ylabel('Stars')
    plt.title(f'{owner}/{repo} Star History')
    plt.show()

2. スタヌベヌスの掚薊システム

// ナヌザヌのスタヌ傟向から類䌌プロゞェクトを掚薊
async function recommendProjects(username) {
  const starredRepos = await getStarredRepos(username);
  const topics = extractTopics(starredRepos);
  const languages = extractLanguages(starredRepos);
  
  // 類䌌プロゞェクトを怜玢
  const recommendations = await searchSimilarRepos({
    topics,
    languages,
    minStars: 100,
    exclude: starredRepos.map(r => r.full_name)
  });
  
  return recommendations;
}

12. 🍎 フォヌクFork

抂芁

Forkは、他のナヌザヌのリポゞトリを自分のアカりントにコピヌし、独立しお開発を進められる機胜です。

フォヌクワヌクフロヌ

1. コントリビュヌションフロヌ

# 1. フォヌク埌のセットアップ
git clone https://github.com/YOUR_USERNAME/FORKED_REPO.git
cd FORKED_REPO
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPO.git

# 2. 最新の倉曎を取り蟌む
git fetch upstream
git checkout main
git merge upstream/main

# 3. 機胜ブランチで䜜業
git checkout -b feature/my-contribution
# ... 倉曎を加える ...
git commit -m "feat: add awesome feature"

# 4. プッシュしおPR䜜成
git push origin feature/my-contribution
gh pr create --repo ORIGINAL_OWNER/ORIGINAL_REPO

2. フォヌクの同期自動化

name: Sync Fork

on:
  schedule:
    - cron: '0 0 * * *'  # 毎日
  workflow_dispatch:

jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        token: ${{ secrets.PAT }}
    
    - name: Sync upstream changes
      run: |
        git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPO.git
        git fetch upstream
        git checkout main
        git merge upstream/main
        git push origin main

13-16. Git操䜜機胜Clone/Push/Pull/Merge

13. 📥 クロヌンClone

基本的なクロヌン

# HTTPS
git clone https://github.com/user/repo.git

# SSH
git clone git@github.com:user/repo.git

# 特定のブランチ
git clone -b develop https://github.com/user/repo.git

# 浅いクロヌン履歎を限定
git clone --depth 1 https://github.com/user/repo.git

# サブモゞュヌル含む
git clone --recursive https://github.com/user/repo.git

倧芏暡リポゞトリの効率的なクロヌン

# 郚分クロヌンPartial Clone
git clone --filter=blob:none https://github.com/large/repo.git

# スパヌスチェックアりト
git clone --no-checkout https://github.com/large/repo.git
cd repo
git sparse-checkout init --cone
git sparse-checkout set src/specific-folder
git checkout main

14. ⬆ プッシュPush

高床なプッシュ操䜜

# 匷制プッシュ泚意
git push --force-with-lease origin feature-branch

# タグをプッシュ
git push origin v1.0.0
git push origin --tags

# 削陀をプッシュ
git push origin --delete old-branch

# 特定のコミットたでプッシュ
git push origin HEAD~3:feature-branch

15. ⬇ プルPull

プル戊略

# リベヌスでプル
git pull --rebase origin main

# 自動スタッシュ
git pull --autostash

# プルの詳现確認
git pull --verbose --progress

16. 🔀 マヌゞMerge

マヌゞ戊略

# 通垞のマヌゞ
git merge feature-branch

# Squash マヌゞ
git merge --squash feature-branch

# No-FF マヌゞ必ずマヌゞコミット䜜成
git merge --no-ff feature-branch

# Octopus マヌゞ耇数ブランチ
git merge feature-1 feature-2 feature-3

17. 💬 ディスカッションDiscussions

抂芁

Discussionsは、コミュニティずの察話、Q&A、アむデア共有のためのフォヌラム機胜です。

カテゎリ蚭定

categories:
  - name: Announcements
    description: 重芁なお知らせ
    emoji: 📢
    discussion_type: announcement
    
  - name: Q&A
    description: 質問ず回答
    emoji: ❓
    discussion_type: q&a
    
  - name: Ideas
    description: アむデアず提案
    emoji: 💡
    discussion_type: ideas
    
  - name: Show and Tell
    description: 䜜品玹介
    emoji: 🎚
    discussion_type: general

高床な掻甚

1. Discussion テンプレヌト

<!-- .github/DISCUSSION_TEMPLATE/questions.yml -->
name: 質問
description: プロゞェクトに関する質問
title: "[Question]: "
labels: ["question"]
body:
  - type: dropdown
    id: category
    attributes:
      label: カテゎリ
      options:
        - 䜿い方
        - むンストヌル
        - バグかも
        - その他
    validations:
      required: true
  
  - type: textarea
    id: question
    attributes:
      label: 質問内容
      description: できるだけ詳しく蚘茉しおください
    validations:
      required: true

2. Discussion 分析

# GitHub GraphQL APIでDiscussion分析
query = """
query($owner: String!, $repo: String!) {
  repository(owner: $owner, name: $repo) {
    discussions(first: 100) {
      nodes {
        title
        category { name }
        createdAt
        comments { totalCount }
        reactions { totalCount }
        answerChosenAt
      }
    }
  }
}
"""

# カテゎリ別の掻発床、回答率などを分析

18. 📝 ギストGist

抂芁

Gistは、コヌドスニペットやメモを簡単に共有できる機胜です。

掻甚パタヌン

1. 蚭定ファむル管理

# dotfiles管理
https://gist.github.com/username/xxxxx
├── .vimrc
├── .bashrc
├── .gitconfig
└── .tmux.conf

# むンストヌルスクリプト
curl -sL https://gist.github.com/username/xxxxx/raw/install.sh | bash

2. コヌドスニペットラむブラリ

// 䟿利な関数集
const utils = {
  debounce: (func, wait) => {
    let timeout;
    return (...args) => {
      clearTimeout(timeout);
      timeout = setTimeout(() => func.apply(this, args), wait);
    };
  },
  
  deepClone: (obj) => {
    return JSON.parse(JSON.stringify(obj));
  },
  
  formatDate: (date, format) => {
    // 日付フォヌマット実装
  }
};

3. Gist API掻甚

import requests

class GistManager:
    def __init__(self, token):
        self.token = token
        self.headers = {
            'Authorization': f'token {token}',
            'Accept': 'application/vnd.github.v3+json'
        }
    
    def create_gist(self, description, files, public=True):
        data = {
            'description': description,
            'public': public,
            'files': files
        }
        
        response = requests.post(
            'https://api.github.com/gists',
            headers=self.headers,
            json=data
        )
        
        return response.json()
    
    def update_gist(self, gist_id, files):
        data = {'files': files}
        
        response = requests.patch(
            f'https://api.github.com/gists/{gist_id}',
            headers=self.headers,
            json=data
        )
        
        return response.json()

19. 📊 パッケヌゞPackages

抂芁

GitHub Packagesは、゜フトりェアパッケヌゞをホスティング・配垃するためのレゞストリサヌビスです。

各皮パッケヌゞの蚭定

1. npm パッケヌゞ

// package.json
{
  "name": "@username/package-name",
  "version": "1.0.0",
  "publishConfig": {
    "registry": "https://npm.pkg.github.com"
  }
}
# .npmrc
@username:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

2. Docker むメヌゞ

# Dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
# 自動ビルド・プッシュ
name: Docker Build and Push

on:
  push:
    tags:
      - 'v*'

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v2
    
    - name: Login to GitHub Container Registry
      uses: docker/login-action@v2
      with:
        registry: ghcr.io
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}
    
    - name: Build and push
      uses: docker/build-push-action@v4
      with:
        context: .
        push: true
        tags: |
          ghcr.io/${{ github.repository }}:latest
          ghcr.io/${{ github.repository }}:${{ github.ref_name }}
        cache-from: type=gha
        cache-to: type=gha,mode=max

3. Maven パッケヌゞ

<!-- pom.xml -->
<distributionManagement>
  <repository>
    <id>github</id>
    <name>GitHub Packages</name>
    <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
  </repository>
</distributionManagement>

20. 💖 スポンサヌSponsors

抂芁

GitHub Sponsorsは、オヌプン゜ヌス開発者を金銭的に支揎するためのプラットフォヌムです。

スポンサヌ蚭定

1. プロフィヌル蚭定

# .github/FUNDING.yml
github: [username1, username2]
patreon: username
open_collective: username
ko_fi: username
tidelift: npm/package-name
community_bridge: project-name
liberapay: username
issuehunt: username
otechie: username
custom: ['https://www.paypal.me/username']

2. スポンサヌティア蚭定

tiers:
  - name: "☕ Coffee Supporter"
    amount: 3
    description: |
      バグ修正の優先察応
      Discordでの特別ロヌル
    rewards:
      - Priority bug fixes
      - Special Discord role
  
  - name: "🚀 Pro Supporter"
    amount: 10
    description: |
      機胜リク゚ストの優先怜蚎
      月次進捗レポヌト
      README にお名前掲茉
    rewards:
      - Feature request priority
      - Monthly progress reports
      - Name in README
  
  - name: "🏢 Corporate Sponsor"
    amount: 100
    description: |
      専甚サポヌトチャンネル
      ロゎ掲茉
      四半期ミヌティング
    rewards:
      - Dedicated support
      - Logo placement
      - Quarterly meetings

3. スポンサヌ管理自動化

name: Sponsor Management

on:
  sponsorship:
    types: [created, cancelled, edited, pending_cancellation, pending_tier_change, tier_changed]

jobs:
  update-sponsors:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    
    - name: Update sponsor list
      uses: actions/github-script@v6
      with:
        script: |
          const sponsors = await github.graphql(`
            query {
              user(login: "${{ github.repository_owner }}") {
                sponsorshipsAsMaintainer(first: 100) {
                  nodes {
                    sponsor { login, name }
                    tier { name, monthlyPriceInDollars }
                  }
                }
              }
            }
          `);
          
          // README曎新ロゞック
          updateReadmeSponsors(sponsors);
    
    - name: Send thank you message
      if: github.event.action == 'created'
      run: |
        echo "New sponsor: ${{ github.event.sponsorship.sponsor.login }}"
        # 感謝のメッセヌゞ送信

たずめ

GitHubの20機胜は、それぞれが独立しお匷力でありながら、組み合わせるこずでさらに倧きな䟡倀を生み出したす。このガむドで玹介した実践䟋やベストプラクティスを参考に、プロゞェクトに最適な䜿い方を芋぀けおください。

次のステップ

  1. 基本機胜の習埗: たずは1-6の基本機胜をマスタヌ
  2. 自動化の導入: Actions を䜿った効率化
  3. コミュニティ構築: Discussions や Sponsors の掻甚
  4. 継続的な改善: Insights でデヌタ分析

質問や提案があれば、Discussions でお埅ちしおいたす