@@ -37,7 +37,7 @@ def fetch_with_retry(url, headers, max_retries=3, timeout=10):
3737hpo_repo = "obophenotype/human-phenotype-ontology"
3838this_repo = os .environ ["GITHUB_REPOSITORY" ]
3939token = os .environ ["GH_TOKEN" ]
40- ppkt_last_run_version = "LAST_RUN_RELEASE"
40+ ppkt_release_name = "LAST_RUN_RELEASE"
4141
4242# Get phenopacket-store latest version
4343latest = fetch_with_retry (
@@ -61,27 +61,27 @@ def fetch_with_retry(url, headers, max_retries=3, timeout=10):
6161
6262# Get last version of phenopacket-store that ppkt2prompt ran
6363r = fetch_with_retry (
64- f"https://api.github.com/repos/{ this_repo } /actions/variables/{ ppkt_last_run_version } " ,
64+ f"https://api.github.com/repos/{ this_repo } /actions/variables/{ ppkt_release_name } " ,
6565 headers = {
6666 "Authorization" : f"token { token } " ,
6767 "Accept" : "application/vnd.github+json"
6868 }
6969)
7070
7171if r .status_code != 200 :
72- print (f"Error: Could not fetch repository variable '{ ppkt_last_run_version } '! Status code: { r .status_code } " )
72+ print (f"Error: Could not fetch repository variable '{ ppkt_release_name } '! Status code: { r .status_code } " )
7373 sys .exit (1 )
7474
75- stored = r .json ().get ("value" )
76- if stored is None :
77- print (f"Error: Repository variable '{ ppkt_last_run_version } ' returned no value." )
75+ stored_ppkt_value = r .json ().get ("value" )
76+ if stored_ppkt_value is None :
77+ print (f"Error: Repository variable '{ ppkt_release_name } ' returned no value." )
7878 sys .exit (1 )
7979
8080latest = latest .strip ()
81- stored = stored .strip ()
81+ stored_ppkt_value = stored_ppkt_value .strip ()
8282latest_hpo = latest_hpo .strip ()
8383
84- new_release = (latest != stored )
84+ new_release = (latest != stored_ppkt_value )
8585
8686with open (os .environ ["GITHUB_OUTPUT" ], "a" ) as gh_out :
8787 gh_out .write (f"new_release={ str (new_release ).lower ()} \n " )
@@ -91,9 +91,9 @@ def fetch_with_retry(url, headers, max_retries=3, timeout=10):
9191
9292# Update variable if needed
9393if new_release :
94- payload = {"name" : ppkt_last_run_version , "value" : latest }
94+ payload = {"name" : ppkt_release_name , "value" : latest }
9595 res = requests .patch (
96- f"https://api.github.com/repos/{ this_repo } /actions/variables/{ latest } " ,
96+ f"https://api.github.com/repos/{ this_repo } /actions/variables/{ ppkt_release_name } " ,
9797 headers = {"Authorization" : f"token { token } " ,
9898 "Accept" : "application/vnd.github+json" },
9999 json = payload ,
@@ -111,4 +111,4 @@ def fetch_with_retry(url, headers, max_retries=3, timeout=10):
111111 # You can also send mail here via SMTP if you prefer Python's smtplib
112112 print (f"Detected new release { latest } from { ppktstore_repo } " )
113113else :
114- print (f"The latest phenopacket-store release { stored } was already run." )
114+ print (f"The latest phenopacket-store release { stored_ppkt_value } was already run." )
0 commit comments