diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..954ff62 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,28 @@ +version: 2 +updates: + # Enable version updates for npm + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + open-pull-requests-limit: 10 + labels: + - "dependencies" + - "automated" + commit-message: + prefix: "chore" + prefix-development: "chore" + include: "scope" + + # Enable version updates for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + labels: + - "dependencies" + - "github-actions" + commit-message: + prefix: "ci" + include: "scope" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..d2bb740 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,38 @@ +documentation: + - changed-files: + - any-glob-to-any-file: + - 'content/**/*.mdx' + - '*.md' + +i18n: + - changed-files: + - any-glob-to-any-file: + - 'content/**/*.zh-CN.mdx' + - 'content/**/*.en.mdx' + - 'lib/i18n.ts' + +ui: + - changed-files: + - any-glob-to-any-file: + - 'app/**/*.tsx' + - 'app/**/*.ts' + - '*.tsx' + +configuration: + - changed-files: + - any-glob-to-any-file: + - '*.config.*' + - 'tsconfig.json' + - 'vercel.json' + +dependencies: + - changed-files: + - any-glob-to-any-file: + - 'package.json' + - 'package-lock.json' + - 'pnpm-lock.yaml' + +workflows: + - changed-files: + - any-glob-to-any-file: + - '.github/**' diff --git a/.github/markdown-link-check-config.json b/.github/markdown-link-check-config.json new file mode 100644 index 0000000..a5056b3 --- /dev/null +++ b/.github/markdown-link-check-config.json @@ -0,0 +1,17 @@ +{ + "ignorePatterns": [ + { + "pattern": "^http://localhost" + }, + { + "pattern": "^https://localhost" + } + ], + "replacements": [], + "httpHeaders": [], + "timeout": "20s", + "retryOn429": true, + "retryCount": 3, + "fallbackRetryDelay": "30s", + "aliveStatusCodes": [200, 206, 301, 302, 307, 308] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4548ec4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Generate source files + run: npx fumadocs-mdx + + - name: Type check + run: npx tsc --noEmit + + - name: Build + run: npm run build + env: + NODE_ENV: production + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + if: success() + with: + name: build-output + path: .next + retention-days: 7 diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 0000000..acc7de0 --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,23 @@ +name: PR Labeler + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + label: + name: Auto Label PR + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Label based on changed files + uses: actions/labeler@v5.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/labeler.yml diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 0000000..e7084ee --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,41 @@ +name: Link Check + +on: + pull_request: + paths: + - 'content/**' + - '**.md' + - '**.mdx' + schedule: + # Run weekly on Monday at 00:00 UTC + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + link-check: + name: Check Links + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check links in content directory + uses: gaurav-nelson/github-action-markdown-link-check@v1.0.15 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'no' + config-file: '.github/markdown-link-check-config.json' + folder-path: 'content/' + check-modified-files-only: ${{ github.event_name == 'pull_request' && 'yes' || 'no' }} + + - name: Check links in root markdown files + uses: gaurav-nelson/github-action-markdown-link-check@v1.0.15 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'no' + config-file: '.github/markdown-link-check-config.json' + file-path: './README.md' + check-modified-files-only: ${{ github.event_name == 'pull_request' && 'yes' || 'no' }} diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..eba71f9 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,44 @@ +name: Preview Deployment + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + preview-info: + name: Preview Information + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Comment PR with deployment info + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.issue.number; + + const comment = `## 🚀 Preview Deployment + + This pull request will be automatically deployed to Vercel. + + ### Preview Links + - 📝 **Documentation**: Will be available once Vercel deployment completes + - 🌍 **Languages**: English (\`/en/docs\`) and Chinese (\`/zh-CN/docs\`) + + ### Build Status + Check the CI workflow for build status and any errors. + + --- + *Automated preview information for PR #${prNumber}*`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + });