cfug / dart.cn

Dart docs localization, get started from the wiki page here: https://github.com/cfug/dart.cn/wiki
https://dart.cn
Other
96 stars 64 forks source link

CI: Site Variable Scanner #458

Closed AmosHuKe closed 6 months ago

AmosHuKe commented 6 months ago

[!IMPORTANT] 该 CI 处于试验阶段
感谢 @AlexV525 的完善建议

用于扫描指定的文档,检查是否存在可用 YAML 变量替换的文本。

类似检查 PR https://github.com/flutter/website/pull/9894 这样的内容

工具

YAML Variable Scanner:AmosHuKe/yaml_variable_scanner 工具的配置:/tool/config/yaml_variable_scanner.yaml

扫描检查本质上就是对纯文本的匹配,不存在语法渲染,
例如:不会渲染 Liquid 变量的使用(类似 {{ xxx }})。
只要文件(md、html...)内容存在 {{ xxx }} 变量使用方式的文本,就可以进行匹配。

运行

$ dart run dart_site check-site-variable

该指令共有 4 个 --print-mode 模式:

$ dart run dart_site check-site-variable --help

Usage: dart_site check-site-variable [arguments]
-h, --help                      Print this usage information.
    --print-mode                Console Print Mode.

          [detail] (default)    Detail to file lines and columns.
          [detailAndStats]      detail & stats.
          [none]                No content.
          [stats]               Total statistics.

检查效果

报错效果:cfug/dart.cn/actions/runs/8499130329/job/23279596806?pr=458#step:5:1
正确效果:cfug/dart.cn/actions/runs/8499217455/job/23279784200?pr=458#step:5:1