Comments (1)
One way that we could ensure this is kept up to date is to actually use the GitHub releases API to get the latest release of one or more repos server-side:
import Octokit from '@octokit/rest'
const github = new Octokit()
const repos = [
{name: 'Primer CSS', owner: 'primer', repo: 'css'},
{name: 'Primer Components', owner: 'primer', repo: 'components'},
{name: 'Octicons', owner: 'primer', repo: 'octicons'},
]
export default class Releases extends React.Component {
static getInitialProps(context) {
return Promise.all(repos.map(({name, owner, repo}) => {
return github.repos.getLatestRelease({owner, repo})
.then(release => ({name, owner, repo, release}))
}))
.then(repos => ({repos})) // [] => {repos: []}
}
render() {
const {repos = []} = this.props
return (
<ul>
{repos.map(({name, owner, repo, release}) => {
const url = `https://github.com/${owner}/${repo}`
return <li><a href={url}>{name}</a> <a href={release.html_url}>{release.name}</a></li>
}))}
</ul>
)
}
}
We might run into API rate limits, but I think that would only happen if like 1000 people visited this page every day? 🤷♀️
from primer.style.
Related Issues (20)
- Problems loading the site on Firefox HOT 1
- Add global search
- Add Presentations to Design dropdown in main nav HOT 1
- Primer.style homepage update: Release 1
- Primer.style homepage update: Release 2 HOT 3
- Primer.style homepage update: Release 3 HOT 1
- Primer.style hompepage update: Release 4 HOT 1
- Use Doctocat Header component HOT 1
- Move team data to Markdown/MDX
- Docked version of SideNav component? HOT 5
- Octicons-v2 webpage not found HOT 4
- Navigation Dropdowns not working on components page HOT 1
- Design and Development navbar dropdowns are broken on https://primer.style/components HOT 2
- Proposal: Rename master to main HOT 2
- Upgrade to Doctocat v2 HOT 1
- Primer.style website incident postmortem
- "Edit this page on GitHub" links broken HOT 2
- [Feature Request]: Collapsable sections in Side Navigation HOT 9
- Latest react release version on the Primer.style is incorrect HOT 1
- `Build and deploy production` workflow fails on forks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from primer.style.