Skip to content

Instantly share code, notes, and snippets.

@shcallaway
Last active February 7, 2024 21:45
Show Gist options
  • Save shcallaway/0e773e49a8a36f1d76320b966252fa4a to your computer and use it in GitHub Desktop.
Save shcallaway/0e773e49a8a36f1d76320b966252fa4a to your computer and use it in GitHub Desktop.
Chrome Bookmarklet that opens GitHub commits merged to master over the past week for a particular repo
console.log("Running bookmarklet...")
// Replace this with your repo URL
var repoUrl = "https://github.com/opkit-co/opkit"
var d = new Date();
d.setDate(d.getDate() - 7);
let dayOfMonth = d.getDate().toString();
// Pad with leading zero
if (dayOfMonth.length < 2) {
dayOfMonth = `0${dayOfMonth}`
}
// Fix zero-indexing
let monthOfYear = (d.getMonth() + 1).toString();
// Pad with leading zero
if (monthOfYear.length < 2) {
monthOfYear = `0${monthOfYear}`
}
// Hardcode master branch and current year :P
var completeUrl = `${repoUrl}/commits/master/?since=2024-${monthOfYear}-${dayOfMonth}`
console.log(`Navigating to: ${completeUrl}`);
window.open(completeUrl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment