Skip to content

Commit 4dcd44c

Browse files
committed
allow local run/debug
1 parent 92e3859 commit 4dcd44c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
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: |

.github/workflows/update_release_table.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import argparse
55
import os
66
import re
7+
import json
78

89
# GitHub repository details
910
REPO = "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
# --------------------------------------------------
2434
def 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",

0 commit comments

Comments
 (0)