You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by yj...@apache.org on 2020/12/05 04:18:37 UTC

[incubator-superset] branch manage-github-workflow updated (46f2710 -> f289e65)

This is an automated email from the ASF dual-hosted git repository.

yjc pushed a change to branch manage-github-workflow
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


 discard 46f2710  format datetime
 discard 2762c62  Fix branch cancel
     new f289e65  Fix branch cancel

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (46f2710)
            \
             N -- N -- N   refs/heads/manage-github-workflow (f289e65)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[incubator-superset] 01/01: Fix branch cancel

Posted by yj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yjc pushed a commit to branch manage-github-workflow
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit f289e65137b40acc4498b66d1e2fa15c2aa8b5b0
Author: Jesse Yang <je...@airbnb.com>
AuthorDate: Fri Dec 4 20:05:00 2020 -0800

    Fix branch cancel
---
 scripts/cancel_github_workflows.py | 23 +++++++++++++----------
 setup.cfg                          |  2 +-
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/scripts/cancel_github_workflows.py b/scripts/cancel_github_workflows.py
index e46d6ca..8539f37 100755
--- a/scripts/cancel_github_workflows.py
+++ b/scripts/cancel_github_workflows.py
@@ -3,14 +3,14 @@
 Manually GitHub workflow runs
 """
 import os
-from typing import List, Iterable, Union, Optional
+from dateutil import parser
+from typing import Iterable, List, Optional, Union
 
-import requests
 import click
+import requests
 from click.exceptions import ClickException
 from typing_extensions import Literal
 
-
 github_token = os.environ.get("GITHUB_TOKEN")
 
 
@@ -43,7 +43,7 @@ def get_runs_by_branch(
     branch: str,
     user: Optional[str] = None,
     statuses: Iterable[str] = ("queued", "in_progress"),
-    events: Iterable[str] = ("pull_request",),
+    events: Iterable[str] = ("pull_request", "push"),
 ):
     """Get workflow runs associated with the given branch"""
     return [
@@ -52,7 +52,7 @@ def get_runs_by_branch(
         for status in statuses
         for item in list_runs(repo, {"event": event, "status": status})["workflow_runs"]
         if item["head_branch"] == branch
-        and (user is None or user == item["head_repository"]["owner"]["login"])
+        and (user is None or (user == item["head_repository"]["owner"]["login"]))
     ]
 
 
@@ -61,9 +61,9 @@ def print_commit(commit):
     indented_message = "    \n".join(commit["message"].split("\n"))
     print(
         f"""
-HEAD {commit["id"]} 
+HEAD {commit["id"]}
 Author: {commit["author"]["name"]} <{commit["author"]["email"]}>
-Date:   {commit["timestamp"]}
+Date:   {parser.parse(commit["timestamp"]).astimezone(tz=None).strftime("%a, %d %b %Y %H:%M:%S")}
 
     {indented_message}
 """
@@ -79,7 +79,7 @@ Date:   {commit["timestamp"]}
 @click.option(
     "--event",
     type=click.Choice(["pull_request", "push", "issue"]),
-    default=["pull_request"],
+    default=["pull_request", "push"],
     multiple=True,
     help="One of more pull_request, push or issue",
 )
@@ -88,7 +88,7 @@ Date:   {commit["timestamp"]}
 )
 @click.option(
     "--keep-running/--no-keep-running",
-    default=False,
+    default=True,
     help="Whether to skip cancelling running workflows",
 )
 @click.argument("branch_or_pull")
@@ -140,7 +140,9 @@ def cancel_github_workflows(
         # Find the head commit SHA of the last created workflow run
         runs = [x for x in runs if x["head_commit"]["id"] != last_sha]
         if not runs:
-            print("Only the latest runs are in queue. Use --no-keep-last to force cancelling them.\n")
+            print(
+                "Only the latest runs are in queue. Use --no-keep-last to force cancelling them.\n"
+            )
             return
 
     last_sha = None
@@ -154,6 +156,7 @@ def cancel_github_workflows(
         print(f"[Cancled] {entry['name']}")
     print("")
 
+
 if __name__ == "__main__":
     # pylint: disable=no-value-for-parameter
     cancel_github_workflows()
diff --git a/setup.cfg b/setup.cfg
index 44f7e0d..ec59008 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,7 +30,7 @@ combine_as_imports = true
 include_trailing_comma = true
 line_length = 88
 known_first_party = superset
-known_third_party =alembic,apispec,backoff,bleach,cachelib,celery,click,colorama,contextlib2,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,humanize,isodate,jinja2,markdown,markupsafe,marshmallow,msgpack,numpy,pandas,parameterized,parsedatetime,pathlib2,polyline,prison,pyarrow,pyhive,pytest,pytz,retry,selenium,setuptools,simplejson,slac [...]
+known_third_party =alembic,apispec,backoff,bleach,cachelib,celery,click,colorama,contextlib2,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,humanize,isodate,jinja2,markdown,markupsafe,marshmallow,msgpack,numpy,pandas,parameterized,parsedatetime,pathlib2,polyline,prison,pyarrow,pyhive,pytest,pytz,requests,retry,selenium,setuptools,simple [...]
 multi_line_output = 3
 order_by_type = false