window.addEventListener('DOMContentLoaded', async () => { const repository = 'ghndrx/docker-test-image'; // Replace with your desired repository const commitCount = 5; // Number of commits to display try { const response = await fetch(`https://api.github.com/repos/${repository}/commits?per_page=${commitCount}`); const commits = await response.json(); const commitList = document.getElementById('commit-list'); if (commits.length > 0) { commits.forEach(commit => { const commitElement = document.createElement('div'); commitElement.classList.add('commit'); commitElement.innerHTML = `

Commit: ${commit.sha}

Date: ${commit.commit.author.date}

Message: ${commit.commit.message}

`; commitList.appendChild(commitElement); }); } else { commitList.innerHTML = '

No commits found.

'; } } catch (error) { console.error('Error fetching commits:', error); } });