Select time range for GitHub repos

Hello team,

I created a GitHub API resource, then a query linked to that resource.

I want to fetch all the active GitHub repos over the last 3 months, and entered the following URL parameter:

q: pushed:>{{ moment().subtract(3, "months").format("YYYY-MM-DD") }}
sort: pushed
orer: desc
per_page: 100

This does not filter the repos though, and I can see all repos.

Should moments.js be installed via npm on the matchine for this time range parameter to work?

Thanks!

Ed

Hi @edtex,
You should not have to install moment.js as it is already included in Retool. Your code looks good to me! :grinning:

I entered the same thing on my end to the github api:
q: pushed:>{{ moment().subtract(3, "months").format("YYYY-MM-DD") }}
and it works for me. It is only showing approximately 17 million repos. If I change the 3 to, say, 9, it increases the count substantially.

Can you check your API Request url in the Output pane on your query page to make sure the q parameter is being set properly?

1 Like

Hello @lindakwoo,
ok thanks for your replay. I think the API request URL is fine because the other URL parameters work fine, but could you share a screenshot to make sure I am looking at the right thing?
edited

@edtex,
Here is a screenshot of my query. Hope this helps!

Also, here is a screenshot of the github api resource itself:

Perfect, thank you @lindakwoo! I can reproduce what you did on the main GitHub portal, but still have issues with my org's Github: I'll keep looking into it!

@lindakwoo I am trying to reproduce the same request on my GitHub at https://api.github.com/users/edmondprin/repos, and I am not able to filter per push date. Any thoughts on how to write the query in Retool ?

nvm I could figure it out, the key element was "search" that you added in the URL parameter. Thank you so much @lindakwoo for your help! I'll close this request.

@edtex ,
This works: https://api.github.com/search/repositories?q=org:edmondprin+pushed:>{{ moment().subtract(10, "months").format("YYYY-MM-DD") }}&order=desc&sort=pushed&per_page=100