Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't delay daily tags for draft PRs #1191

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 29 additions & 22 deletions ci/check-open-pr
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
# we do not need to wait any longer.

from __future__ import print_function
from github import Github,GithubException
import os, sys, pytz
from datetime import datetime
import json
import os
import sys
from datetime import datetime
import pytz
from github import Github


def utc_to_local(utc_dt):
tz = pytz.timezone("Europe/Zurich")
Expand Down Expand Up @@ -53,25 +56,29 @@ for pull in gh.get_repo(repo_name).get_pulls():
wait_for_build = True
what_approved = None

# Collect statuses (review and required build checks). Beware, states are
# cumulative (state history is kept). We should only keep the first one per
# given context, the others are old!
for st in pull.base.repo.get_commit(pull.head.sha).get_statuses():
if st.context == "review" and not review:
review = st.state
what_approved = st.description
if st.context in checks and not st.context in build:
# This is one of the mandatory tests
build[st.context] = st.state
if st.state == "error":
wait_for_build = False

# Take a decision. If we need to wait, exit from the program with nonzero
# Policy: we need all PRs to be:
# * opened before the deadline,
# * review == "success" with status == "merge approved" (not just testing)
# * all build statuses must NOT be "error"
wait_for_build = (wait_for_build and review == "success" and what_approved == "merge approved")
if pull.draft:
wait_for_build = False
else:
# Collect statuses (review and required build checks). Beware, states are
# cumulative (state history is kept). We should only keep the first one per
# given context, the others are old!
for st in pull.base.repo.get_commit(pull.head.sha).get_statuses():
if st.context == "review" and not review:
review = st.state
what_approved = st.description
if st.context in checks and st.context not in build:
# This is one of the mandatory tests
build[st.context] = st.state
if st.state == "error":
wait_for_build = False

# Take a decision. If we need to wait, exit from the program with nonzero
# Policy: we need all PRs to be:
# * opened before the deadline,
# * review == "success" with status == "merge approved" (not just testing)
# * all build statuses must NOT be "error"
wait_for_build = (wait_for_build and review == "success" and
what_approved == "merge approved")

# Print out the current status
decision = "must wait" if wait_for_build else "not waiting: bad state"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PyGithub==1.45
PyGithub==1.55
argparse
requests
pytz
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

install_requires = ['PyGithub==1.45', 'argparse', 'requests', 'pytz', 's3cmd',
install_requires = ['PyGithub==1.55', 'argparse', 'requests', 'pytz', 's3cmd',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure this works everywhere?

'pyyaml']
# Old setuptools versions (which pip2 uses) don't support range comparisons
# (like :python_version >= "3.6") in extras_require, so do this ourselves here.
Expand Down