File tree Expand file tree Collapse file tree 10 files changed +491
-0
lines changed Expand file tree Collapse file tree 10 files changed +491
-0
lines changed Original file line number Diff line number Diff line change
1
+ # https://github.com/settings/personal-access-tokens
2
+ GITHUB_TOKEN =
Original file line number Diff line number Diff line change
1
+ use flake
2
+ dotenv_if_exists
Original file line number Diff line number Diff line change
1
+ .direnv /
2
+ .pre-commit-config.yaml
3
+
4
+ .env
Original file line number Diff line number Diff line change
1
+ import os
2
+ from github import Github , PullRequest
3
+ from typing import List
4
+
5
+ REPO = "PrismLauncher/PrismLauncher"
6
+ MILESTONE = "7.2"
7
+ TOKEN = os .environ ["GITHUB_TOKEN" ]
8
+
9
+
10
+ def getter (index ):
11
+ return lambda x : x [index ]
12
+
13
+
14
+ if __name__ == "__main__" :
15
+ output = []
16
+
17
+ g = Github (TOKEN )
18
+
19
+ repo = g .get_repo (REPO )
20
+
21
+ release_milestone = None
22
+
23
+ for milestone in repo .get_milestones ():
24
+ if milestone .title == MILESTONE :
25
+ release_milestone = milestone
26
+ break
27
+
28
+ commits = []
29
+
30
+ for issue in repo .get_issues (milestone = release_milestone , state = "all" ):
31
+ if issue .pull_request :
32
+ pr = issue .as_pull_request ()
33
+
34
+ if not pr .merged :
35
+ print (f"skip { pr .id } " )
36
+ continue
37
+
38
+ commit = repo .get_commit (pr .merge_commit_sha )
39
+
40
+ a = (commit .commit .committer .date , commit .sha )
41
+
42
+ commits .append (a )
43
+ print (a )
44
+
45
+ commits_sorted = [* sorted (commits , key = getter (0 ))]
46
+
47
+ print (" " .join ([* map (getter (1 ), commits_sorted )]))
Original file line number Diff line number Diff line change
1
+ {
2
+ inputs = {
3
+ nixpkgs . url = "github:nixos/nixpkgs/nixpkgs-unstable" ;
4
+ flake-parts . url = "github:hercules-ci/flake-parts" ;
5
+ pre-commit-hooks = {
6
+ url = "github:cachix/pre-commit-hooks.nix" ;
7
+ inputs . nixpkgs . follows = "nixpkgs" ;
8
+ inputs . nixpkgs-stable . follows = "nixpkgs" ;
9
+ } ;
10
+ } ;
11
+
12
+ outputs = inputs :
13
+ inputs . flake-parts . lib . mkFlake
14
+ { inherit inputs ; }
15
+ { imports = [ ./nix ] ; } ;
16
+ }
Original file line number Diff line number Diff line change
1
+ from github import Github , PullRequest
2
+ from typing import List
3
+
4
+ REPO = "PrismLauncher/PrismLauncher"
5
+ MILESTONE = "7.2"
6
+ TOKEN = os .environ ["GITHUB_TOKEN" ]
7
+
8
+
9
+ def pr_link (pr ):
10
+ return f"[#{ pr } ](https://github.com/PrismLauncher/PrismLauncher/pull/{ pr } )"
11
+
12
+
13
+ def author_link (author ):
14
+ return f"[@{ author } ](https://github.com/{ author } )"
15
+
16
+
17
+ def human_list (x : List [str ]):
18
+ if len (x ) < 1 :
19
+ return "WTF??"
20
+ elif len (x ) == 1 :
21
+ return x [0 ]
22
+ y = ", " .join (x [:- 1 ])
23
+ y += f" and { x [- 1 ]} "
24
+ return y
25
+
26
+
27
+ def process_pr (pr : PullRequest ):
28
+ authors = [author_link (pr .user .login )]
29
+ commits = pr .get_commits ()
30
+ for c in commits :
31
+ if not c .author :
32
+ print (c )
33
+ continue
34
+ login = author_link (c .author .login )
35
+ # this is ugly, but it is the best way to maintain the order of the list without dumb hacks
36
+ if login not in authors :
37
+ authors .append (login )
38
+
39
+ return f" - { pr .title } by { human_list (authors )} in { pr_link (pr .number )} "
40
+
41
+
42
+ if __name__ == "__main__" :
43
+ output = []
44
+
45
+ g = Github (TOKEN )
46
+
47
+ repo = g .get_repo (REPO )
48
+
49
+ release_milestone = None
50
+
51
+ for milestone in repo .get_milestones ():
52
+ if milestone .title == MILESTONE :
53
+ release_milestone = milestone
54
+ break
55
+
56
+ for issue in repo .get_issues (milestone = release_milestone , state = "all" ):
57
+ if issue .pull_request :
58
+ output .append (process_pr (issue .as_pull_request ()))
59
+
60
+ for x in sorted (output ):
61
+ print (x )
You can’t perform that action at this time.
0 commit comments