Skip to content

Commit

Permalink
Use the latest build status when checking docs.rs (#7613)
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.

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
  • Loading branch information
Nemo157 and repo-ranger[bot] authored Feb 20, 2022
1 parent d3638b1 commit 3dc5613
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions services/docsrs/docsrs.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ export default class DocsRs extends BaseJsonService {
}

async handle({ crate, version = 'latest' }) {
const { build_status: buildStatus } = (
await this.fetch({ crate, version })
).pop()
const [{ build_status: buildStatus }] = await this.fetch({ crate, version })
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: 'docs@0.16.1', message: 'failing' })

t.create('Multiple builds, latest passing')
.get('/bevy_tweening/0.3.1.json')
.expectBadge({ label: 'docs@0.3.1', message: 'passing' })

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

0 comments on commit 3dc5613

Please sign in to comment.