Skip to content

Commit

Permalink
Use the latest build status when checking docs.rs
Browse files Browse the repository at this point in the history
When documentation for a crate is rebuilt the `builds.json` can return
multiple results, ordered latest first, so we must take the first
element of the array rather than the last.
  • Loading branch information
Nemo157 committed Feb 16, 2022
1 parent a1885cd commit 1a4b51f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion services/docsrs/docsrs.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class DocsRs extends BaseJsonService {
async handle({ crate, version = 'latest' }) {
const { build_status: buildStatus } = (
await this.fetch({ crate, version })
).pop()
).shift()
return this.constructor.render({ version, buildStatus })
}
}
4 changes: 4 additions & 0 deletions services/docsrs/docsrs.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ t.create('Failing docs')
.get('/tensorflow/0.16.1.json')
.expectBadge({ label: '[email protected]', message: 'failing' })

t.create('Multiple builds, latest passing')
.get('/bevy_tweening/0.3.1.json')
.expectBadge({ label: '[email protected]', message: 'passing' })

t.create('Getting latest version works')
.get('/rand/latest.json')
.expectBadge({
Expand Down

0 comments on commit 1a4b51f

Please sign in to comment.