diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b49aedd..84f300e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -192,6 +192,7 @@ jobs: build-args: | COMMIT_SHA=${{ github.sha }} GITHUB_REPOSITORY=${{ github.repository }} + GH_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new diff --git a/Dockerfile b/Dockerfile index 16621e8..719328d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,8 @@ ARG COMMIT_SHA ENV COMMIT_SHA=$COMMIT_SHA ARG GITHUB_REPOSITORY ENV GITHUB_REPOSITORY=$GITHUB_REPOSITORY +ARG GH_ACCESS_TOKEN +ENV GH_ACCESS_TOKEN=$GH_ACCESS_TOKEN ENV NODE_ENV=production RUN mkdir /app diff --git a/others/build-info.js b/others/build-info.js index da0f15f..e8c7623 100644 --- a/others/build-info.js +++ b/others/build-info.js @@ -3,11 +3,18 @@ const fs = require('fs') const fetch = require('node-fetch') const SHA = process.env.COMMIT_SHA +const GH_ACCESS_TOKEN = process.env.GH_ACCESS_TOKEN async function getCommitInfo() { try { const response = await fetch( `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/commits/${SHA}`, + { + method: 'GET', + headers: { + Authorization: `token ${GH_ACCESS_TOKEN}`, + }, + }, ) const data = await response.json()