Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

dtslint-runner should not compare against master on DT PRs

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
shell, typescript
领域
ci-cd, tooling

调研方向

定位 dtslint-runner 及其 git diff 逻辑,然后将其与 scripts/pnpm-install.sh 中对 merge-base 的处理进行比较。检查 CI 如何识别 pull request,以及 merge commit 如何暴露 HEAD^1。完成的标准是 PR 运行针对 PR 的稳定 merge-base 进行比较,而不是针对更新的 origin/master,从而不会将无关的 package 报告为已更改。

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

描述

dtslint-runner diffs against master. If someone merges a PR at the exact same time as another PR's CI runs, they'll pull origin/master and may get the wrong thing. For example, in https://github.com/DefinitelyTyped/DefinitelyTyped/actions/runs/7452339628/job/20275379960?pr=68135:

Running: git rev-parse --verify master
Running: git fetch origin master

Running: git branch master FETCH_HEAD

Running: git diff master --name-status
M	types/matter-js/index.d.ts
M	types/slate-html-serializer/index.d.ts
M	types/slate-html-serializer/tsconfig.json
Testing 2 changed packages: Set(2) { 'matter-js', 'slate-html-serializer' }
Testing 0 dependent packages: Set(0) {}

dtslint-runner fetches master, but gets a newer master than the PR, so it believes that the PR modified matter-js, when it was actually another PR merged to master. I partially fixed this for pnpm install in https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/scripts/pnpm-install.sh; since PRs are run on merge commits in CI, HEAD^1 points to an already pulled / stable merge base (what the PR thinks master is at the time of the CI run; further runs will get newer merge bases so it's not out of date).

This then causes further failures because pnpm install is installing the "correct" dependency set, which does not include matter-js.

In CI, it's easy to tell that we're in a PR. But, I'm not totally sure of the right mechanism to check in dtslint-runner, but we should definitely do it.

主要语言
TypeScript
星标
422
派生
238
平均合并
1 天 4 小时
30 天内合并 PR
8

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

microsoft/DefinitelyTyped-tools 的其他 Issue

查看 microsoft/DefinitelyTyped-tools 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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