diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 041e88f..d7e24b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,8 @@ jobs: - name: Fetch pull request data run: npm run compose-db + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Deploy to GitHub Pages 🚀 uses: JamesIves/github-pages-deploy-action@releases/v3 diff --git a/compose-db.js b/compose-db.js index 6ed1beb..5bfb013 100644 --- a/compose-db.js +++ b/compose-db.js @@ -22,6 +22,9 @@ async function fetchGithub(url) { const init = {}; init.headers = {}; init.headers["Accept"] = "application/vnd.github.v3+json"; + if (process.env.GITHUB_TOKEN) { + init.headers["Authorization"] = `token ${process.env.GITHUB_TOKEN}`; + } return await fetch(`https://api.github.com${url}`, init); }