-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ClaytonTDM <[email protected]>
- Loading branch information
1 parent
be8c73b
commit 4e5c522
Showing
1 changed file
with
52 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Changelog</title> | ||
</head> | ||
<body> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const commitList = document.createElement("ul"); | ||
document.body.appendChild(commitList); | ||
const apiUrl = | ||
"https://api.github.com/repos/roblnet13/pvz/commits"; | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Changelog</title> | ||
</head> | ||
<body> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const commitList = document.createElement("ul"); | ||
document.body.appendChild(commitList); | ||
const apiUrl = | ||
"https://api.github.com/repos/roblnet13/pvz/commits"; | ||
|
||
fetch(apiUrl) | ||
.then((response) => response.json()) | ||
.then((commits) => { | ||
commits.forEach((commit) => { | ||
const listItem = document.createElement("li"); | ||
const itemText = document.createElement("pre"); | ||
itemText.innerHTML = `<b>${commit.commit.author.name}</b>: `; | ||
itemText.innerText += commit.commit.message; | ||
commitList.appendChild(listItem); | ||
listItem.appendChild(itemText); | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.error("Error fetching commits:", error); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
fetch(apiUrl) | ||
.then((response) => response.json()) | ||
.then((commits) => { | ||
commits.forEach((commit) => { | ||
const listItem = document.createElement("li"); | ||
const itemText = document.createElement("pre"); | ||
const authorName = commit.commit.author.name; | ||
const commitMessage = commit.commit.message; | ||
const coAuthors = []; | ||
|
||
// Extract co-authors if present | ||
const coAuthorRegex = /Co-authored-by: ([^<]+) <[^>]+>/g; | ||
let match; | ||
while ((match = coAuthorRegex.exec(commitMessage)) !== null) { | ||
coAuthors.push(match[1]); | ||
} | ||
|
||
let allAuthors; | ||
if (coAuthors.length === 1) { | ||
allAuthors = `${authorName} and ${coAuthors[0]}`; | ||
} else if (coAuthors.length > 1) { | ||
allAuthors = `${coAuthors.length + 1} people`; | ||
} else { | ||
allAuthors = authorName; | ||
} | ||
|
||
itemText.innerHTML = `<b>${allAuthors}</b>: `; | ||
itemText.innerText += commitMessage.split("\n")[0]; | ||
|
||
commitList.appendChild(listItem); | ||
listItem.appendChild(itemText); | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.error("Error fetching commits:", error); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |