Browse Source

设置运行路径

liuyuqi-dellpc 1 year ago
parent
commit
cac311f801
2 changed files with 3 additions and 4 deletions
  1. 3 2
      main.py
  2. 0 2
      set_github_secret/set_github_secret.py

+ 3 - 2
main.py

@@ -7,10 +7,11 @@
 @Desc    :   enter point
 '''
 from set_github_secret import GithubApi
-import json
+import json,os
 
 if __name__=='__main__':
-    with open("account.json", "r") as file:
+    current_run_path = os.path.dirname(os.path.realpath(__file__))
+    with open(os.path.join(current_run_path,"account.example.json"), "r") as file:
         data = json.load(file)
         owner=data["owner"]
         token=data["token"]

+ 0 - 2
set_github_secret/set_github_secret.py

@@ -7,8 +7,6 @@
 @Desc    :   github api方式设置 Create or update a repository secret
 '''
 
-import requests
-import json
 import requests
 from nacl import encoding, public
 import json,sys