2021-02-08 14:32:23 +01:00
|
|
|
import requests, pprint, os
|
2021-02-07 08:06:36 +01:00
|
|
|
|
2021-02-07 08:38:37 +01:00
|
|
|
GITEA_TOKEN = os.getenv("GITEA_TOKEN")
|
2021-02-07 08:06:36 +01:00
|
|
|
BASE_URL = "https://git.augendre.info/api/v1"
|
|
|
|
|
|
|
|
def main():
|
2021-02-08 11:14:24 +01:00
|
|
|
session = requests.Session()
|
|
|
|
session.headers.update({"Authorization": f"token {GITEA_TOKEN}"})
|
|
|
|
res = session.get(f"{BASE_URL}/user/repos", params={"limit": 40})
|
|
|
|
repos = res.json()
|
2021-02-07 08:06:36 +01:00
|
|
|
|
2021-02-08 11:14:24 +01:00
|
|
|
for repo in repos:
|
|
|
|
full_name = repo["full_name"]
|
|
|
|
url = f"{BASE_URL}/repos/{full_name}"
|
|
|
|
res = session.patch(url, json={
|
|
|
|
'has_issues': True,
|
|
|
|
'internal_tracker': {'enable_time_tracker': False, 'allow_only_contributors_to_track_time': True, 'enable_issue_dependencies': True}
|
|
|
|
})
|
|
|
|
print(full_name, res.status_code)
|
2021-02-07 08:06:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-02-08 11:14:24 +01:00
|
|
|
main()
|