Skip to content

Commit ccc9dda

Browse files
restyled-commitskliao-csa
authored andcommitted
Restyled by autopep8
1 parent 70858eb commit ccc9dda

File tree

1 file changed

+34
-31
lines changed

1 file changed

+34
-31
lines changed

scripts/helpers/poll_quick_ci.py

+34-31
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,40 @@
22
import subprocess
33
import time
44

5+
56
def main():
6-
parser = argparse.ArgumentParser()
7-
parser.add_argument("pr", help="Pull request number")
8-
parser.add_argument("check", help="Pull request check to poll for")
9-
args = parser.parse_args()
10-
11-
print(f"Gathering info on the {args.check} check being run for the current pull request.")
12-
polling = True
13-
poll_count = 0
14-
poll_max = 300
15-
check_passed = False
16-
while(polling):
17-
for line in subprocess.run(f"gh pr checks -R project-chip/connectedhomeip {args.pr}", stdout=subprocess.PIPE, shell=True).stdout.decode("utf-8").splitlines():
18-
if args.check in line:
19-
print(line)
20-
if "pending" in line:
21-
if poll_count == poll_max:
22-
polling = false
23-
else:
24-
poll_count += 1
25-
time.sleep(1)
26-
break
27-
elif "pass" in line:
28-
print(f"Fast CI {args.check} has passed; if all fast CI passes, builds and tests may commence.")
29-
exit(0)
30-
elif "fail" in line:
31-
print(f"Fast CI {args.check} has failed; please resolve this issue before running builds and tests.")
32-
exit(1)
33-
34-
print(f"Polling for completion of fast CI {args.check} failed. Please ensure the name of the check was entered correctly and verify that it should take less than {poll_max} seconds to run.")
35-
exit(1)
7+
parser = argparse.ArgumentParser()
8+
parser.add_argument("pr", help="Pull request number")
9+
parser.add_argument("check", help="Pull request check to poll for")
10+
args = parser.parse_args()
11+
12+
print(f"Gathering info on the {args.check} check being run for the current pull request.")
13+
polling = True
14+
poll_count = 0
15+
poll_max = 300
16+
check_passed = False
17+
while (polling):
18+
for line in subprocess.run(f"gh pr checks -R project-chip/connectedhomeip {args.pr}", stdout=subprocess.PIPE, shell=True).stdout.decode("utf-8").splitlines():
19+
if args.check in line:
20+
print(line)
21+
if "pending" in line:
22+
if poll_count == poll_max:
23+
polling = false
24+
else:
25+
poll_count += 1
26+
time.sleep(1)
27+
break
28+
elif "pass" in line:
29+
print(f"Fast CI {args.check} has passed; if all fast CI passes, builds and tests may commence.")
30+
exit(0)
31+
elif "fail" in line:
32+
print(f"Fast CI {args.check} has failed; please resolve this issue before running builds and tests.")
33+
exit(1)
34+
35+
print(
36+
f"Polling for completion of fast CI {args.check} failed. Please ensure the name of the check was entered correctly and verify that it should take less than {poll_max} seconds to run.")
37+
exit(1)
38+
3639

3740
if __name__ == "__main__":
38-
main()
41+
main()

0 commit comments

Comments
 (0)