Last 7 days of Pull Requests

Since bookmarks can be JavaScript we can dynamically create a URL based on some data. In this case the data is the current date. We'll use that to create a GitHub search filter for pull requests created in the last 7 days.

const today = new Date();
const lastWeek = new Date(new Date().setDate(new Date().getDate() - 7));

const created = [
  [lastWeek.getFullYear(), lastWeek.getUTCMonth() + 1, lastWeek.getDate()].join("-"),
  [today.getFullYear(), today.getUTCMonth() + 1, today.getDate()].join("-"),
].join("..");

const url = new URL("https://github.com/pulls");
const params = new URLSearchParams();

params.set(
  "q", 
  'is:pr author:@me is:closed created:' + created
);

url.search = params.toString();

window.location.href = url.toString();

Then we just need to compress the JavaScript, URL encode it, stick the javascript: protocol in front of the script and stick it in a URL. You can drag that into your bookmarks bar and now you have a easy shortcut to the work you did last week, ready for your next Monday standup!

Last 7 days of PRs.

Note that you'll need to update user name (author:koddsson) in the original script and then recreate the bookmarklet again to get your pull requests. I used https://caiorss.github.io/bookmarklet-maker/ to create my bookmarklet.

Edits:

2024/10/21: @carlocab_ pointed out that I can use author:@me instead of hard-coding a username in the script.