Skip to content

Commit

Permalink
fix: try tags without v as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed May 3, 2019
1 parent 750417b commit 53f97f1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ node_modules
lib
es
.eslintcache
*.js
*.js.flow
!/src/**
!/test/**
/*.js
/*.js.flow
/util
!/.babelrc.js
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ fall back to trying to parse the package's `CHANGELOG.md` or `changelog.md`.
GitHub releases are way more reliable for this purpose though, so please use
them!

# Caveats

`what-broke` inevitably fails to find changelog entries for some packages/releases
because many maintainers are not very detail-oriented about it (and don't choose
to use excellent tools that would do the work for them, like
[`semantic-release`](https://github.com/semantic-release/semantic-release)).

However, I've also seen cases where some versions were never published to npm
(for instance, at the time of writing, `superagent` version 5.0.0 was never
published to npm, yet it does have a changelog entry). `what-broke` currently
only displays changelog entries for published versions.

# API Tokens

GitHub heavily rate limits public API requests, but allows more throughput for
Expand Down
18 changes: 13 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,19 @@ export async function whatBroke(
const { owner, repo } = parseRepositoryUrl(url)

try {
const body = (await octokit.repos.getReleaseByTag({
owner,
repo,
tag: `v${version}`,
})).data.body
const body = (await octokit.repos
.getReleaseByTag({
owner,
repo,
tag: `v${version}`,
})
.catch(() =>
octokit.repos.getReleaseByTag({
owner,
repo,
tag: version,
})
)).data.body

release.body = body

Expand Down

0 comments on commit 53f97f1

Please sign in to comment.