summaryrefslogtreecommitdiff
path: root/admin/get_merged_prs.py
blob: b9d0ee238a3320abf961cab6b2e083e26ecc7647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Get all merged PRs since last release, save them to a JSON file"""

import httpx
import json


r = httpx.get(
    "https://api.github.com/repos/rdflib/rdflib/pulls",
    params={
        "state": "closed",
        "per_page": 100,
        "page": 2,  # must get all pages up to date of last release
    },
)
prs = []
if r.status_code == 200:
    for pr in r.json():
        if pr["merged_at"] is not None:
            prs.append(
                {
                    "url": pr["url"],
                    "title": pr["title"],
                    "merged_at": pr["merged_at"],
                }
            )
    with open("prs2.json", "w") as f:
        json.dump(prs, f)
else:
    print("ERROR")