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
The following commit(s) were added to refs/heads/manage-github-workflow by this
push:
new 2762c62 Fix branch cancel
2762c62 is described below
commit 2762c62c3650d1b728b0e41f71cebe95842a7e4f
Author: Jesse Yang <[email protected]>
AuthorDate: Fri Dec 4 20:05:00 2020 -0800
Fix branch cancel
---
scripts/cancel_github_workflows.py | 20 +++++++++++---------
setup.cfg | 2 +-
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/scripts/cancel_github_workflows.py
b/scripts/cancel_github_workflows.py
index e46d6ca..5028728 100755
--- a/scripts/cancel_github_workflows.py
+++ b/scripts/cancel_github_workflows.py
@@ -3,14 +3,13 @@
Manually GitHub workflow runs
"""
import os
-from typing import List, Iterable, Union, Optional
+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 +42,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 +51,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,7 +60,7 @@ 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"]}
@@ -79,7 +78,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 +87,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 +139,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 +155,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