Created
November 8, 2022 08:43
-
-
Save NagariaHussain/ccbc5261e6702a8355cb59c720e6fa17 to your computer and use it in GitHub Desktop.
Hints for implementing deploy on all required checks passed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check apps/press/press/press/doctype/app_source/app_source.py | |
# branch = get branch from github API while creating app release | |
required_checks = branch.get["protection"]["required_status_checks"]["checks"] | |
if len(required_checks) == 0: | |
# No required checks, continue as it is now | |
else: | |
# for check in required_checks | |
# populate a child table? | |
# Listen to a webhook for checks getting completed instead of | |
# requesting | |
github_response = requests.get( | |
f"https://api.github.com/repos/{self.repository_owner}/{self.repository}/commits/c7619cec9275f3f730405c70310823b6ed0cd999/check-runs", | |
headers=headers | |
) | |
checks = github_response.json() | |
total_num_checks = checks.get("total_count") | |
all_checks = checks.get("check_runs") | |
succeeded_checks = [] | |
for check in all_checks: | |
if check["conclusion"] == "success": | |
succeeded_checks.append(check) | |
succeeded_num_checks = len(succeeded_checks) | |
all_checks_passed = total_num_checks == succeeded_num_checks | |
# Store as much information as required in app release DocType |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For frappe/press#565