main.py 1020 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @Contact : liuyuqi.gov@msn.cn
  5. @Time : 2023/11/13 15:27:04
  6. @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
  7. @Desc : enter point
  8. '''
  9. from set_circleci_secret import circleciApi
  10. from set_circleci_secret.utils.frozen_dir import get_app_path
  11. import yaml,os,sys
  12. if __name__=='__main__':
  13. current_run_path = get_app_path()
  14. conf_path = os.path.join(current_run_path, "account.yml")
  15. if os.path.exists(conf_path):
  16. with open(conf_path, "r") as file:
  17. data = yaml.load(file, Loader=yaml.FullLoader)
  18. owner=data["owner"]
  19. token=data["token"]
  20. repo = data["repo"]
  21. circleci_api = circleciApi(owner=owner, token=token, repo=repo)
  22. for i in data["secret"]:
  23. key=i["key"]
  24. value=i["value"]
  25. circleci_api.set_update_circleci_secret(key, value)
  26. else:
  27. print(f"account.yml not found, current path: {conf_path}")