Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
Created February 2, 2022 15:34
Embed
What would you like to do?
Open Github pull request list page filtered to closed PRs from the last week from a given team
#!/bin/bash
#
# Script that opens the Github pull request search page filtered to show closed pull
# requests from the last week, from members of a specified set of users.
#
# This can be useful for team leads when writing progress reports.
# Config
# ------
# Specify org slug here.
ORG_SLUG=acme
TEAM_USERNAMES=(
user1
user2
user3
)
# -------
main() {
# Build array of query params.
local query_params=(
is:pr
archived:false
"updated:%3E"$(date --date="1 week ago" +"%Y-%m-%d")
is:closed
"user:$ORG_SLUG"
"sort:updated-desc"
)
for username in "${TEAM_USERNAMES[@]}"
do
query_params+=("involves:${username}")
done
# Build a query string.
local query_string=$(IFS=+; echo "${query_params[*]}")
# Open PR list page with appropriate filters.
open "https://github.com/pulls?q=$query_string"
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment