检查查找器
- 作者仓库星标 176,634
- 作者仓库 flutter
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @flutter · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 命令执行
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Flutter PR Checks Finder
## Prerequisites
- `gh` (GitHub CLI) must be installed and authenticated. If not in your PATH, check common locations like `/opt/homebrew/bin/gh` on macOS or `C:\Program Files\GitHub CLI\gh.exe` on Windows.
- Access to `curl` or similar tool to fetch raw logs from LUCI.
## Workflow
### 1. Find Failing Checks
You can use the `gh` CLI if it's installed and authenticated, or use direct HTTP requests to the GitHub API as a fallback.
#### Option A: Using `gh` CLI (Preferred)
Run the following command to list checks:
```bash
gh pr checks <PR_NUMBER>
```
#### Option B: Using GitHub API via HTTP
If `gh` is not available, you can use `read_url_content` or a similar method to interact with the public GitHub API:
1. **Find the PR SHA**:
Make an HTTP request to: `https://api.github.com/repos/flutter/flutter/pulls/<PR_NUMBER>`
Extract the `head.sha` field.
2. **List Check Runs**:
Make an HTTP request to: `https://api.github.com/repos/flutter/flutter/commits/<PR_SHA>/check-runs`
Parse the JSON response. **CRITICAL**: You must handle pagination to avoid missing failures! Check the `total_count` field. If it is greater than the number of items in the `check_runs` array (typically capped at 100 or what you set with `per_page`), make additional HTTP requests by appending `?per_page=100&page=<N>` to the URL for each subsequent page until all check runs are fetched. Identify all checks that have failed (i.e., where `conclusion` is `failure`).
Identify all checks that have failed.
### 2. Retrieve Failure Logs
For each failing check:
1. **Find the Log URL**:
- Look for the target URL or link associated with the check.
- The `flutter-dashboard` link typically appears as "View more details on flutter-dashboard" at the bottom of the check view on GitHub.
- Alternatively, you can reconstruct the link to the LUCI page based on the name of the failing check and the build number if available.
Example LUCI URL structure: `https://ci.chromium.org/ui/p/flutter/builders/try/<Builder Name>/<Build Number>/overview`
2. **Build Raw Log URL**:
- **Manual**: Reconstruct the raw log URL by appending `?format=raw` to the log URL or by following the pattern: `https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/<Build ID>/+/u/<Step Name>/stdout?format=raw`
3. **Fetch Raw Logs**:
- Use `curl` or similar tool to fetch the content of the raw log URL.
- **CRITICAL**: You must use the raw log URL to avoid HTML formatting and truncated output. **Do NOT rely solely on the check summary in the GitHub API, as it may be truncated or lack full context.**
### Builder to Step Name Mapping
> [!NOTE]
> Step names can be very specific and hard to guess. This section documents patterns to help find them.
#### Recipes & Tools
* **`flutter_drone` Recipe**
* **Description:** Originates from the [cocoon][] or [recipes][] repository. It is typically used for running sharded framework tests and lints (like `analyze`, `test_general`) as specified in [.ci.yaml (root)][ci-yaml-root].
* **Pattern:** `run test.dart for <shard> shard and subshard <subshard>`
* **URL Transformation:** Spaces are replaced by underscores.
* **Default:** If `subshard` is not specified, it defaults to `None`.
* **Example:** For `Linux analyze` (shard: `analyze`, no subshard), the URL step name is `run_test.dart_for_analyze_shard_and_subshard_None`.
* **`builder.py` & Related Recipes**
* **Description:** Found in the `flutter/engine` repository (or recipes repository) and used to execute builds and tests according to target JSON configurations in the [builders folder][builders-folder] directory.
* **Pattern:** Typically the task name specified in the JSON configuration, often prefixed with `test: `.
* **URL Transformation:** Spaces are replaced by underscores.
* **Gotcha:** If the test name already starts with `test: ` in the JSON file, the recipe might still add the prefix again (e.g., `test:_test:_Check_formatting`).
* **`tester.py`**
* **Description:** A common helper script in the engine's CI recipes used to execute tests.
* **Pattern:** `Run <shard> tests` or `Run <shard> <subshard> tests`.
* **URL Transformation:** Spaces are replaced by underscores.
#### Locating Exact Names in Engine
If guessing fails, find the exact test and task names in the engine configuration:
1. Look up the builder in [.ci.yaml (engine)][ci-yaml-engine] to find its `config_name` property.
2. Locate the corresponding JSON file in the [builders folder][builders-folder] directory.
3. Read the JSON file to find the `tests` array and the specific `tasks` listed within them.
#### Fallback
If `read_url_content` fails with 404 on guessed step names, you may need to find the step name from the LUCI overview page or other sources.
[cocoon]: https://github.com/flutter/cocoon
[recipes]: https://github.com/flutter/recipes
[ci-yaml-root]: ../../../.ci.yaml
[ci-yaml-engine]: ../../../engine/src/flutter/.ci.yaml
[builders-folder]: ../../../engine/src/flutter/ci/builders/
章节与文件索引
按说明文件中的顺序排列。
先决条件
1. 查找失败的检查
2. 检索失败日志
构建器到步骤名称的映射
文件/命令 -> /opt/homebrew/bin/gh · C:\Program Files\GitHub CLI\gh.exe · curl · read_url_content · https://api.github.com/repos/flutter/flutter/pulls/<PR_NUMBER> · head.sha · https://api.github.com/repos/flutter/flutter/commits/<PR_SHA>/check-runs · total_count
内容校验值 -> 26704af0520c
当前原文的自动摘译,尚未人工审校。
先决条件
gh(GitHub CLI) 必须安装并经过身份验证。如果不在您的路径中,请检查常见位置,例如/opt/homebrew/bin/gh在 macOS 或C:\Program Files\GitHub CLI\gh.exe在 Windows 上。访问curl或类似的工具从 LUCI 获取原始日志。1. 查找失败的检查
您可以使用
ghCLI(如果已安装并经过身份验证),或者使用对 GitHub API 的直接 HTTP 请求作为后备。选项 A:使用ghCLI(首选)运行以下命令来列出检查: 选项 B:通过 HTTP 使用 GitHub API 如果gh不可用,您可以使用read_url_content或与公共 GitHub API 交互的类似方法:2. 检索失败日志
对于每个失败的检查: 查找日志 URL:查找与检查关联的目标 URL 或链接。的
flutter-dashboard链接通常在 GitHub 上的检查视图底部显示为“查看 flutter-dashboard 的更多详细信息”。或者,您可以根据失败检查的名称和内部版本号(如果可用)重建 LUCI 页面的链接。构建器到步骤名称的映射
[!NOTE] 步骤名称可能非常具体且难以猜测。本节记录了模式以帮助找到它们。食谱和工具
flutter_drone配方描述:源自[cocoon][]或[recipes][]存储库。它通常用于运行分片框架测试和 lints(例如analyze,test_general)如 [.ci.yaml (root)][ci-yaml-root] 中指定。