Skip to content

Commit e32e203

Browse files
[core] Fix docs GitHub API rate limit (mui#34856)
1 parent 5df95f1 commit e32e203

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

docs/next.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ module.exports = withDocsInfra({
150150
};
151151
},
152152
env: {
153-
GITHUB_AUTH: process.env.GITHUB_AUTH,
153+
GITHUB_AUTH: process.env.GITHUB_AUTH
154+
? `Basic ${Buffer.from(process.env.GITHUB_AUTH).toString('base64')}`
155+
: null,
154156
LIB_VERSION: pkg.version,
155157
FEEDBACK_URL: process.env.FEEDBACK_URL,
156158
SLACK_FEEDBACKS_TOKEN: process.env.SLACK_FEEDBACKS_TOKEN,

docs/pages/versions.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ function formatVersion(version) {
2222
}
2323

2424
async function getBranches() {
25-
// TODO: find an appropriate way to prevent "API rate limit exceeded"
26-
// const githubAuthorizationToken = process.env.GITHUB_AUTH || '';
27-
2825
const result = await fetch('https://api.github.com/repos/mui/material-ui-docs/branches', {
29-
// headers: {
30-
// Authorization: `Basic ${Buffer.from(githubAuthorizationToken).toString('base64')}`,
31-
// },
26+
headers: {
27+
Authorization: process.env.GITHUB_AUTH,
28+
},
3229
});
3330
const text = await result.text();
3431

0 commit comments

Comments
 (0)