remove github token for public repo

This commit is contained in:
quoije
2025-02-04 21:44:47 -05:00
parent cfb23a7cfc
commit 9c91eefd89
+2 -4
View File
@@ -11,13 +11,11 @@ const router = express.Router();
async function fetchLatestCommitFromGitHub() { async function fetchLatestCommitFromGitHub() {
const githubOwner = process.env.GITHUB_OWNER; // Your GitHub username or org const githubOwner = process.env.GITHUB_OWNER; // Your GitHub username or org
const githubRepo = process.env.GITHUB_REPO; // Your repository name const githubRepo = process.env.GITHUB_REPO; // Your repository name
const githubToken = process.env.GITHUB_TOKEN; // A GitHub personal access token for authentication (optional) const githubToken = ""; // A GitHub personal access token for authentication (optional)
try { try {
const url = `https://api.github.com/repos/${githubOwner}/${githubRepo}/commits`; const url = `https://api.github.com/repos/${githubOwner}/${githubRepo}/commits`;
const headers = githubToken ? { Authorization: `token ${githubToken}` } : {}; // Add token if available const response = await axios.get(url);
const response = await axios.get(url, { headers });
if (response.data && response.data.length > 0) { if (response.data && response.data.length > 0) {
const latestCommit = response.data[0]; const latestCommit = response.data[0];