Skip to content

Commit

Permalink
feat: support GITHUB_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Oct 16, 2024
1 parent ced94ed commit 7593e8b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,14 @@ class CppReferenceExtension {
*/
async setupMrDocs(playbook, cacheDir) {
const mrDocsTreeDir = path.join(cacheDir, 'mrdocs')
const releasesResponse = await axios.get('https://api.github.com/repos/cppalliance/mrdocs/releases')
const GH_TOKEN = process.env.GITHUB_TOKEN || process.env.GH_TOKEN || ''
const apiHeaders = GH_TOKEN ? {
'User-Agent': 'request',
'Authorization': `Bearer ${GH_TOKEN}`
} : {
'User-Agent': 'request'
}
const releasesResponse = await axios.get('https://api.github.com/repos/cppalliance/mrdocs/releases', {headers: apiHeaders})
const releasesInfo = releasesResponse.data
this.logger.debug(`Found ${releasesInfo.length} MrDocs releases`)
let downloadUrl = undefined
Expand Down

0 comments on commit 7593e8b

Please sign in to comment.