Skip to content

Commit 53f97f1

Browse files
committed
fix: try tags without v as well
1 parent 750417b commit 53f97f1

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ node_modules
44
lib
55
es
66
.eslintcache
7-
*.js
8-
*.js.flow
9-
!/src/**
10-
!/test/**
7+
/*.js
8+
/*.js.flow
9+
/util
1110
!/.babelrc.js

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ fall back to trying to parse the package's `CHANGELOG.md` or `changelog.md`.
1717
GitHub releases are way more reliable for this purpose though, so please use
1818
them!
1919

20+
# Caveats
21+
22+
`what-broke` inevitably fails to find changelog entries for some packages/releases
23+
because many maintainers are not very detail-oriented about it (and don't choose
24+
to use excellent tools that would do the work for them, like
25+
[`semantic-release`](https://github.com/semantic-release/semantic-release)).
26+
27+
However, I've also seen cases where some versions were never published to npm
28+
(for instance, at the time of writing, `superagent` version 5.0.0 was never
29+
published to npm, yet it does have a changelog entry). `what-broke` currently
30+
only displays changelog entries for published versions.
31+
2032
# API Tokens
2133

2234
GitHub heavily rate limits public API requests, but allows more throughput for

src/index.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@ export async function whatBroke(
103103
const { owner, repo } = parseRepositoryUrl(url)
104104

105105
try {
106-
const body = (await octokit.repos.getReleaseByTag({
107-
owner,
108-
repo,
109-
tag: `v${version}`,
110-
})).data.body
106+
const body = (await octokit.repos
107+
.getReleaseByTag({
108+
owner,
109+
repo,
110+
tag: `v${version}`,
111+
})
112+
.catch(() =>
113+
octokit.repos.getReleaseByTag({
114+
owner,
115+
repo,
116+
tag: version,
117+
})
118+
)).data.body
111119

112120
release.body = body
113121

0 commit comments

Comments
 (0)