Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
53 changes: 53 additions & 0 deletions .github/workflows/dart-format-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Dart Format Auto-Fix

# Automatically run `dart format` on PRs and push fixes back when the code is
# not properly formatted. This keeps style consistent without reviewer nudging.
#
# 对 PR 自动执行 `dart format`;格式不合规时由 bot 自动提交修复,
# 避免 reviewer 反复挑格式问题。
on:
pull_request:
types:
- opened
- synchronize
- reopened
# Allow manual runs from the Actions tab (formats the default branch).
# 允许在 Actions 页手动触发(对默认分支执行格式化)。
workflow_dispatch:

permissions:
contents: write

jobs:
format:
name: Auto-format Dart code
runs-on: ubuntu-latest
steps:
- name: Checkout PR head
uses: actions/checkout@v7
with:
# Use the PR's head ref so we can push fixes back to the same branch.
# 使用 PR 的 head ref,以便把修复推回同一分支。
ref: ${{ github.head_ref }}

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Format code
run: dart format .

- name: Commit and push fixes
# Only commit if dart format actually changed something.
# 仅当 dart format 确实产生了改动时才提交。
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -am "style: auto-format with dart format"
git push
else
echo "No formatting changes needed."
fi
50 changes: 50 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Link Check

# Scan documentation for dead/broken links using lychee.
# Only user-facing docs are checked to keep the job fast and avoid false
# positives from internal/anchor links.
#
# 使用 lychee 扫描文档中的死链/坏链。仅检查用户向文档以提升速度、减少误报。
on:
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- 'README.md'
- 'README_zh.md'
- 'CHANGELOG.md'
- 'docs/**'
# Allow manual runs from the Actions tab.
# 允许在 Actions 页手动触发。
workflow_dispatch:

permissions:
contents: read

jobs:
link-check:
name: Check documentation links
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Run lychee link checker
uses: lycheeverse/lychee-action@v2
with:
# Only scan the documented files; accept 200/206/301/302/304, timeouts
# and 429 (rate limit) are retried. Fail only on real broken links.
# 仅扫描文档文件;失败仅针对真正坏掉的链接。
args: >
--no-progress
--accept 200,206,301,302,304
--timeout 20
--retry-wait-time 2
--max-retries 2
--exclude-mail
README.md README_zh.md CHANGELOG.md "docs/**"
fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ This file defines the architecture, coding conventions, and required workflows f
- `ci.yml`: `actions/checkout@v7`, `subosito/flutter-action@v2`, `actions/cache@v5` (pub cache keyed on `pubspec.lock` plus `example/pubspec.lock`); runs `flutter analyze`, `flutter test`, and `pana` score check.
- `stale.yml`: `actions/stale@v11` marks stale issues/PRs.
- `dependabot-pr-bilingual.yml`: `actions/github-script@v7` appends a bilingual (EN-primary, ZH-secondary) summary to the **body** of Dependabot PRs only (`github.actor == 'dependabot[bot]'`, idempotent via marker). It does NOT touch the PR title or commit subject — those stay English per the Conventional Commits rule. When reviewing Dependabot PRs, verify the build passes, check changelogs for breaking changes on major bumps, and confirm the caret (`^`) constraint is preserved.
- `dart-format-fix.yml`: on PR `opened`/`synchronize`/`reopened` (and `workflow_dispatch` manual trigger), runs `dart format .` and, if it changed anything, auto-commits and pushes the fix back to the **same PR branch** as `github-actions[bot]`. Keeps style consistent without reviewer nudging. Note: uses `pull_request` (not `pull_request_target`) with `permissions: contents: write`; if branch protection blocks workflow pushes or requires signed commits, switch it to open a fix branch / post a comment instead.
- `link-check.yml`: on PR changes to `README.md`, `README_zh.md`, `CHANGELOG.md`, `docs/**` (and `workflow_dispatch` manual trigger), runs `lychee-action@v2` to scan those docs for dead/broken links and fails only on real broken links (mailto and common redirects/rate-limits are excluded). Use the Actions tab manual run to scan the default branch on demand.
- `pr-title-check.yml` details: allowed types are `feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert`; `requireScope` is `false`; PRs labeled `dependencies` or `github-actions` are ignored. The same type list applies to commit messages (Conventional Commits).
- `paths-ignore` skips user-facing docs (`README*.md`, `CHANGELOG.md`, `TODO.md`, `wiki/**`, `docs/**`) to save CI minutes, but it MUST NOT blanket-ignore all `**.md`. `AGENTS.md` and `.codebuddy/**` are intentionally kept out of `paths-ignore` so docs-only PRs still run the required checks and can merge (branch protection requires 3 passing checks; a skipped `ci.yml` would block the merge). Never reintroduce `'**.md'` to `paths-ignore`.

Expand Down
Loading