Skip to content

Instantly share code, notes, and snippets.

@andfanilo
Last active March 21, 2022 18:10
Show Gist options
  • Save andfanilo/bce47cec3b53eb5a23a5032b8c3295bc to your computer and use it in GitHub Desktop.
Save andfanilo/bce47cec3b53eb5a23a5032b8c3295bc to your computer and use it in GitHub Desktop.
Query to sort issues in Github project per number of +1 reactions
import streamlit as st
from ghapi.all import GhApi
@st.experimental_singleton
def load_ghapi():
return GhApi()
@st.experimental_memo
def search_query(q: str):
return load_ghapi().search.issues_and_pull_requests(q, per_page=10)
def search_stargazers():
return paged(load_ghapi().activity.list_stargazers_for_repo, "streamlit", "streamlit", headers={"Accept": "application/vnd.github.v3.star+json"})
st.title("Get the open issues with most reactions")
repo = st.text_input("Enter repo (as username/repository)", "streamlit/streamlit")
if repo == "":
st.stop()
query = f"repo:{repo} is:open reactions:>10 sort:reactions-+1-desc"
res = search_query(query)
for item in res.get("items"):
with st.expander(item.title):
st.markdown(item.body)
@andfanilo
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment