Skip to content

Commit b09e96a

Browse files
committed
✨ Update a couple of community queries
1 parent e3f71a1 commit b09e96a

4 files changed

+53
-2
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
title = "How many downloads got each release of a GitHub repository?"
3+
description = "Get the number of downloads for each release of a GitHub repository"
4+
5+
plugins = ["github"]
6+
7+
author = "julien040"
8+
9+
tags = ["github", "downloads", "releases"]
10+
11+
arguments = [
12+
{title="repository", display_title = "Repository name (owner/repo format)", type="string", description="The repository to fetch stars from (owner/repo)", regex="^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$"}
13+
]
14+
15+
*/
16+
WITH
17+
releases_assets AS (
18+
SELECT
19+
r.name as release_id,
20+
js.value ->> 'download_count' as downloads
21+
FROM
22+
github_releases_from_repository (@repository) r,
23+
json_each (assets) js
24+
)
25+
SELECT
26+
release_id as release,
27+
sum(downloads) as downloads
28+
FROM
29+
releases_assets
30+
GROUP BY
31+
release_id
32+
ORDER BY
33+
release_id ASC;

queries/issues-assigned.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SELECT
1515
created_at,
1616
title,
1717
repository,
18-
'https://github.com' || repository || '/issues/' || "number" as url
18+
'https://github.com/' || repository || '/issues/' || "number" as url
1919
FROM
2020
github_my_issues ('assigned')
2121
WHERE

queries/pull-request-assigned.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SELECT
1515
created_at,
1616
title,
1717
repository,
18-
'https://github.com' || repository || '/issues/' || "number" as url
18+
'https://github.com/' || repository || '/issues/' || "number" as url
1919
FROM
2020
github_my_issues ('assigned')
2121
WHERE

queries/unread-emails.sql

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
title = "What are my unread emails?"
3+
description = "List all the emails that are unread"
4+
5+
plugins = ["imap"]
6+
7+
author = "julien040"
8+
9+
tags = ["imap", "emails", "unread"]
10+
*/
11+
SELECT
12+
subject,
13+
received_at,
14+
_from as senders
15+
FROM
16+
imap_emails
17+
WHERE
18+
flags NOT LIKE '%"Seen"%';

0 commit comments

Comments
 (0)