Accessing the latest build from the web UI


#1

I found a way to get the info about the latest build of a project via the API (/api/repos/:owner/:repo/builds/latest), but as far as I see, it is not possible to navigate to the latest build from the web ui. I’d love a feature like this, so I could bookmark the latest build, or link to it, or something along those lines. Without having to manually hit the API first to get the last build number, that is.

Looking at src/screens/layouts.js, there’s this part:

<Route
       path="/:owner/:repo/:build(\d*)"
       component={BuildLogsTitle}
/>

This seems to suggest that it is limited to numbers, which is further reinforced by src/screens/repo/screens/build/index.js:

const binding = (props, context) => {
	const { owner, repo, build } = props.match.params;
	const slug = `${owner}/${repo}`;
	const number = parseInt(build);

	return {
		repo: ["repos", "data", slug],
		build: ["builds", "data", slug, number],
	};
};

The number here gets parsed as an int.

Would it make sense to change the route, to also allow /latest, and the BuildLogsTitle component to use the number as-is as a string?

I would have tried doing that locally, but I’m struggling with building Drone myself. If I manage to do that, I’ll report back, and possibly submit a pull request too. Figured I’ll write up the idea first, in case someone else is working on it already.