GitHub Action: observe runs are counted as surface=cli, because the Observe step never sets DIFFCI_SURFACE

未关闭
#284 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@FredApps 已经在做这个了。

开始于 2026年11月17日。

  • #285 来自 @FredApps —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
github-actions, node.js, typescript

调研方向

Read the observe step in action.yml and compare its environment with action/verify.sh, which already exports DIFFCI_SURFACE=github-action. Check packages/diffci-cli/src/client/telemetry.ts for how the surface is read, then verify the Action metadata check in the issue passes. A linked open pull request (#285) already addresses this issue.

由索引模型根据 Issue 内容生成。

描述

What went wrong?

The output or a command was wrong or confusing

DiffCI version

0.3.54 (the Action's default cli-version on main, 40aa308)

Command you ran

The public DiffCI/core change impact Action, default verify: "false". Its Observe step runs the published CLI:

npx --yes --ignore-scripts --no-audit --fund=false --package "@diffci.com/[email protected]" diffci observe --repo "$DIFFCI_REPO"

without DIFFCI_SURFACE=github-action in that step's environment (action.yml, the observe step).

Environment

Any GitHub Actions runner; Node 22 (the Action's default). Reproduced by reading action.yml and packages/diffci-cli/src/client/telemetry.ts on main (40aa308).

Output

surfaceOf in packages/diffci-cli/src/client/telemetry.ts only returns github-action when DIFFCI_SURFACE is that string. GITHUB_ACTIONS is used for the ci flag, not for surface. So an observation from the Action is sent to https://app.diffci.com/v1/usage-events with surface: "cli".

The opt-in fast check is already counted correctly: action/verify.sh exports DIFFCI_SURFACE=github-action. The GitLab component sets DIFFCI_SURFACE=gitlab-component, which telemetry counts. The Azure DevOps task sets DIFFCI_SURFACE=azure-devops-task, but telemetry's surfaceOf doesn't recognise that value and counts it as cli. That is a separate gap, filed as #303. Among the wrappers, only the Action's default path (observe) sets no surface at all.

A check that reads the Action metadata fails on main:

# from a worktree of main, after npm ci
node --input-type=module -e '
import { readFileSync } from "node:fs";
import { parse } from "yaml";
const action = parse(readFileSync("action.yml", "utf8"));
const observe = action.runs.steps.find((s) => s.id === "observe");
if (observe?.env?.DIFFCI_SURFACE !== "github-action") {
  console.error("observe env DIFFCI_SURFACE:", observe?.env?.DIFFCI_SURFACE);
  process.exit(1);
}
'
observe env DIFFCI_SURFACE: undefined
What you expected

Observe runs started by the GitHub Action are counted as surface: "github-action", the same as verify from that Action, and as the GitLab component already does for its observe path. (The Azure task's value isn't recognised yet; see #303.) Adoption by surface is then accurate. docs/telemetry.md already lists github-action as a surface the Action is supposed to report.

主要语言
TypeScript
星标
0
派生
4
平均合并
18 小时 41 分钟
30 天内合并 PR
48

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DiffCI/core 的其他 Issue

查看 DiffCI/core 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。