File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 40
40
python-version : ' 3.x' # Specify the version of Python to use
41
41
42
42
- name : Install dependencies
43
- run : python -m pip install --upgrade pip && pip install requests
43
+ run : python -m pip install --upgrade pip && pip install requests chardet
44
44
45
45
- name : Run Python script
46
46
run : |
Original file line number Diff line number Diff line change 4
4
import argparse
5
5
import os
6
6
import re
7
+ import json
7
8
8
9
# GitHub repository details
9
10
REPO = "TravisWheelerLab/sufr"
@@ -14,16 +15,26 @@ def get_args():
14
15
parser = argparse .ArgumentParser (
15
16
description = "Update a specific release in GitHub."
16
17
)
18
+
17
19
parser .add_argument (
18
20
"version" , help = "The tag name of the release to update"
19
21
)
22
+
23
+ parser .add_argument (
24
+ "-j" ,
25
+ "--json" ,
26
+ type = argparse .FileType ("rt" ),
27
+ help = "Local JSON file"
28
+ )
29
+
20
30
return parser .parse_args ()
21
31
22
32
23
33
# --------------------------------------------------
24
34
def main ():
25
35
args = get_args ()
26
- releases = get_releases_data ()
36
+ releases = get_releases_data (args .json )
37
+ print (releases )
27
38
28
39
if release_to_update := find_release_by_version (releases , args .version ):
29
40
release_id = release_to_update ["id" ]
@@ -43,7 +54,10 @@ def main():
43
54
44
55
45
56
# --------------------------------------------------
46
- def get_releases_data ():
57
+ def get_releases_data (file ):
58
+ if file :
59
+ return json .loads (file .read ())
60
+
47
61
headers = {
48
62
"Authorization" : f'token { os .getenv ("GITHUB_TOKEN" )} ' ,
49
63
"Accept" : "application/vnd.github.v3+json" ,
You can’t perform that action at this time.
0 commit comments