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 4040 python-version : ' 3.x' # Specify the version of Python to use
4141
4242 - 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
4444
4545 - name : Run Python script
4646 run : |
Original file line number Diff line number Diff line change 44import argparse
55import os
66import re
7+ import json
78
89# GitHub repository details
910REPO = "TravisWheelerLab/sufr"
@@ -14,16 +15,26 @@ def get_args():
1415 parser = argparse .ArgumentParser (
1516 description = "Update a specific release in GitHub."
1617 )
18+
1719 parser .add_argument (
1820 "version" , help = "The tag name of the release to update"
1921 )
22+
23+ parser .add_argument (
24+ "-j" ,
25+ "--json" ,
26+ type = argparse .FileType ("rt" ),
27+ help = "Local JSON file"
28+ )
29+
2030 return parser .parse_args ()
2131
2232
2333# --------------------------------------------------
2434def main ():
2535 args = get_args ()
26- releases = get_releases_data ()
36+ releases = get_releases_data (args .json )
37+ print (releases )
2738
2839 if release_to_update := find_release_by_version (releases , args .version ):
2940 release_id = release_to_update ["id" ]
@@ -43,7 +54,10 @@ def main():
4354
4455
4556# --------------------------------------------------
46- def get_releases_data ():
57+ def get_releases_data (file ):
58+ if file :
59+ return json .loads (file .read ())
60+
4761 headers = {
4862 "Authorization" : f'token { os .getenv ("GITHUB_TOKEN" )} ' ,
4963 "Accept" : "application/vnd.github.v3+json" ,
You can’t perform that action at this time.
0 commit comments